Reputation:
I have a drop down, and on this drop down I want to fill it with the data I have on the other database table.
P.S - My dropdown and its other form inputs have its own database table namely tbl_movies , and on the dropdown itself which I want to fill in the data o the database table namely tbl_clients .
Should I make a relationship or what not? Idk sorry help and guide me pls
I have this dropdown form and how should I fill it with data on the other table ?
{{Form::select('client', null,
['class' => 'form-control', 'placeholder' => 'Select Status...'])}}
Upvotes: 0
Views: 515
Reputation: 1570
Get your data from table and Pass data from your controller to view
$data['movies'] = Movies::pluck('name','id');
return view('viewPageName',$data); // pass your data to view page from controller
On your view file instead of your select use this
{{Form::select('client', $movies,
['class' => 'form-control', 'placeholder' => 'Select Status...'])}}
Hope this idea will help you!
Upvotes: 1