Laravel Eloquent Collection and Query -


 public function create() {             $user_id = auth()->user()->id;             $makers= maker::all();             return view('maker.create', compact('makers'));         } 

what wanted how pass categories name view form accept id. please help.

$makers collection, need use foreach iterate:

@foreach ($makers $maker)     {{ $maker->id }} @endforeach 

update

if want pass form::select, use pluck() method:

$makers = maker::pluck('name', 'id'); 

it generate array, can use:

{!! form::select('selectname', $makers, ....) !!} 

Comments