estoy intentando crear un formulario para editar registros pero me dice que la variable que le paso es undefined.
Metodo edit:
public function edit($id){
$editData = Customer::find($id);
$editData['holdings'] = Holding::all();
return view('backend.customer.edit-customer', compact('editData'));
}
Metodo update:
public function update(Request $request, $id){
$customer = Customer::find($id);
$customer->holding_id = $request->holding_id;
$customer->tipoCuenta_id = $request->tipoCuenta_id;
$customer->company = $request->company;
$customer->legal_entity = $request->legal_entity;
$customer->mobile_no = $request->mobile_no;
$customer->email = $request->email;
$customer->country = $request->country;
$customer->state = $request->state;
$customer->city = $request->city;
$customer->address = $request->address;
$customer->postal = $request->postal;
$customer->cuit = $request->cuit;
$customer->website = $request->website;
$customer->updated_by = Auth::user()->id;
$customer->save();
Session::flash('success');
return redirect()->route('customers.view');
}
Ahora el error me lo marca cuando le paso la variable a un foreach en la vista:
<div class="form-group col-md-6">
<label for="holding_id">Tipo de Producto</label>
<select name="holding_id" class="form-control">
<option value="">Seleccionar</option>
@foreach ($holdings as $holding)
<option value="{{ $holding->id }}" {{ ($$editData->holding_id==$holding->id)?"selected":'' }}>{{ $holding->name }}</option>
@endforeach
</select>
</div>
El error exacto es $holdings is undefined, pero no entiendo porque si le estoy pasando bien la variable.