Dynamic pick list in Laravel with the basic Form package

Hello everyone. I have been looking for some time and cannot find it in my documentation. Does anyone know how to create a dynamic select list in laravel using a form-base plugin?

thanks

+4
source share
2 answers
public function user_options() { return array('' => 'Choose a User') + User::lists('id', 'name'); } {{ Form::select('user_id', UserWhateverForm::user_options(), UserWhateverForm::old('user_id')) }} 
+9
source
 echo Form::select('size', array('L' => 'Large', 'S' => 'Small'), 'S'); 

In an array, you can dynamically specify parameters / value. The last option is the default value.

See the documentation.

-1
source

Source: https://habr.com/ru/post/1447478/


All Articles