laravel-admin
laravel-admin copied to clipboard
Form select load, how to pass additional criteria
- Laravel Version: 9.19
- PHP Version: PHP Version:8.0.5
- Laravel-admin: 1.8.17
Description:
I have an optional user_id select/dropdown in form
$form->select('user_id', __('User'))->options(User::where([['status','=',1]])->pluck('name', 'id'));
and 2 more dropdown to load brands and models
$form->select('brand_id', __('Brand'))->options(Brand::all()->pluck('title_en', 'id'))->load('model_id', '/admin/load-models')->rules('required');
$form->select('model_id', __('Model'))->options(BrandModel::all()->pluck('title_en', 'id'))->rules('required');
How i can load Models that belongs to user, if any selected.
A user can have some brands and models already in table, if a user selected, list should be only that belongs to user, otherwise load all models
In other words for brands ->load('model_id', '/admin/load-models')
only brand id passed and available in controller, how i can pass additional criteria.
Steps To Reproduce:
check this.