I'm working on a form with Raveladmin.
$director=[
'John' = > 1,
'Smith' = > 2,
'Kate' = > 3,
];
$form->select('director', 'Director') ->options($director);
The value of select will be passed in an array as
If this value is maintained in DB, what is the best way to look at it?
Among me,
$director=DB::table('director')->get();
All I can think of is a way to convert the referenced value and give it to you...
If you leave it as it is, you will get an error, so
Must be converted to the form 'val' = > 'Option name'...
It may be elementary, but I appreciate your cooperation.
php laravel
I solved myself.
I was able to refer to this writing method!
$form->select('director', 'Director') ->options(
DB::table('oga_section') - > pluck('director_name', 'director_id')
);
© 2024 OneMinuteCode. All rights reserved.