Laravel Multi Select Dropdown With Checkbox Example

Hello artisan,

In this laravel multi select dropdown with checkbox example, you will see how to create a html form for laravel multi select dropdown with checkbox. To create this multi select dropdown with checkbox bootstrap example, I will use bootstrap multiselect. 

If you need to use bootstrap multiselect dropdown with a checkbox in your laravel 6, laravel 7, laravel 8 and laravel 9 app then I will give you a simple example of how users can use and get selected items from the select box in laravel controller.

I will use the bootstrap-select plugin for a multi-select dropdown with a checkbox. Bootstrap-select provides to easy search option and selects it with the checkbox. In this example, I will give you a simple blade file code and what will output when you select multiple items. I will also show you how you can store items as JSON arrays.

Blade File

 

Controller Code:

public function postData(Request $request)
{
    $input = $request->all();
    $input['cat'] = json_encode($input['cat']);
  
    Post::create($input);
   
    dd('Post created successfully.');
}

 

Read also: Dynamic Multi Select Dropdown and Search in Laravel

 

Hope it can help you.

 

#laravel #select2 #jquery