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.
PS - 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...'])}}
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.