<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>multiselect dropdown Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/multiselect-dropdown/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/multiselect-dropdown/</link>
	<description>Code Solution</description>
	<lastBuildDate>Wed, 16 Jun 2021 23:00:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>multiselect dropdown Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/multiselect-dropdown/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Laravel 8 Multiselect Dropdown with Checkbox In Bootstrap 4</title>
		<link>https://codeplaners.com/laravel-8-multiselect-dropdown-with-checkbox-in-bootstrap-4/</link>
					<comments>https://codeplaners.com/laravel-8-multiselect-dropdown-with-checkbox-in-bootstrap-4/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 16 Jun 2021 23:00:18 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Laravel 8]]></category>
		<category><![CDATA[multiselect dropdown]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1000</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you laravel 8 multiselect dropdown with checkbox in bootstrap 4. This article will give you simple example of laravel 8 multiselect dropdown with checkbox in bootstrap 4. you will learn laravel 8 multiselect dropdown with checkbox in bootstrap 4. In this artical i will show you laravel 8 &#8230; <a href="https://codeplaners.com/laravel-8-multiselect-dropdown-with-checkbox-in-bootstrap-4/" class="more-link">Continue reading<span class="screen-reader-text"> "Laravel 8 Multiselect Dropdown with Checkbox In Bootstrap 4"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-multiselect-dropdown-with-checkbox-in-bootstrap-4/">Laravel 8 Multiselect Dropdown with Checkbox In Bootstrap 4</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you laravel 8 multiselect dropdown with checkbox in bootstrap 4. This article will give you simple example of laravel 8 multiselect dropdown with checkbox in bootstrap 4. you will learn laravel 8 multiselect dropdown with checkbox in bootstrap 4.</p>
<p>In this artical i will show you laravel 8 multiselect dropdown with checkbox in bootstrap 4. When we make a blog website, we need the multiselect dropdown function. We can use this example in Laravel 6, Laravel 7, Laravel 8, all. So let&#8217;s follow few step to create example of laravel 8 multiselect dropdown with checkbox in bootstrap 4.</p>
<p><strong>Preview:</strong><br />
<img decoding="async" style="border: 3px solid #ff5722;" src="https://codeplaners.com/wp-content/uploads/2021/06/multiselect.png" alt="Laravel 8 Multiselect Dropdown with Checkbox In Bootstrap 4" ></p>
<h3>Step 1:- Install Laravel</h3>
<p>First of, open your terminal and  install new Laravel:</p>
<pre class="brush: php; title: ; notranslate">
composer create-project --prefer-dist laravel/laravel multiselect 
</pre>
<h3>Step 2:- Connect Database .env</h3>
<pre class="brush: php; title: ; notranslate">
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=databse
DB_USERNAME=root
DB_PASSWORD=
</pre>
<h3>Step 3:- Create Modal and Migration</h3>
<p>In this step, we need to create category table and model</p>
<pre class="brush: php; title: ; notranslate">
php artisan make:model Category -m
</pre>
<p><strong>database\migrations\create_categories_table.php</strong></p>
<pre class="brush: php; title: ; notranslate">
public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
			$table-&gt;id();
			$table-&gt;string('name');
			$table-&gt;timestamps();
		});
    }
</pre>
<p><strong>app\Models\Category.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
 
namespace App\Models;
 
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
 
class Category extends Model
{
    protected $fillable = &#x5B;
        'name'
    ];
}
</pre>
<p>run following command</p>
<pre class="brush: php; title: ; notranslate">
php artisan migrate
</pre>
<h3>Step 4:- Add Routes</h3>
<pre class="brush: php; title: ; notranslate">
use App\Http\Controllers\CategoryController;

Route::get('cat', &#x5B;CategoryController::class, 'index']);
Route::post('store', &#x5B;CategoryController::class, 'store']);
</pre>
<h3>Step 5:- Create Controllers</h3>
<p>run following command and create controllers</p>
<pre class="brush: php; title: ; notranslate">
php artisan make:controller CategoryController 
</pre>
<p><strong>app/http/controller\CategoryController.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
namespace App\Http\Controllers;
use App\Models\Category;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

class CategoryController extends Controller
{
    public function index()
    {
        return view('index');
    }
 
    public function store(Request $request)
    {
        $input = $request-&gt;all();
        $data = &#x5B;];
        $data&#x5B;'name'] = json_encode($input&#x5B;'name']);
 
        Category::create($data);
 
        return response()-&gt;json(&#x5B;'success'=&gt;'Recoreds inserted']);        
    }
}
</pre>
<h3>Step 6:- Create Blade Views</h3>
<p>In this step, create one blade views file. <strong>resources/views</strong> folder and create the blade view file:</p>
<p>Create file <strong>index.blade.php</strong> and add code:</p>
<pre class="brush: php; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Laravel 8 Multiselect Dropdown with Checkbox In Bootstrap 4&lt;/title&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css&quot;&gt;
    &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.js&quot;&gt;&lt;/script&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css&quot; /&gt;
    &lt;meta name=&quot;csrf-token&quot; content=&quot;{{ csrf_token() }}&quot;&gt;
&lt;/head&gt;
&lt;body style=&quot;background: #8ab4e8;&quot;&gt;

    &lt;div class=&quot;container&quot; &gt;
    	&lt;h2 align=&quot;center&quot;&gt;Laravel 8 Multiselect Dropdown with Checkbox In Bootstrap 4&lt;/h2&gt;
    
    &lt;form method=&quot;post&quot; id=&quot;category_form&quot;&gt;
    	&lt;div class=&quot;form_select&quot;&gt;
            &lt;label&gt;Select&lt;/label&gt;
                &lt;select id=&quot;category&quot; name=&quot;name&#x5B;]&quot; multiple class=&quot;form-select&quot; &gt;
                &lt;option value=&quot;Codeigniter&quot;&gt;Codeigniter&lt;/option&gt;
                &lt;option value=&quot;CakePHP&quot;&gt;CakePHP&lt;/option&gt;
                &lt;option value=&quot;Laravel&quot;&gt;Laravel&lt;/option&gt;
                &lt;option value=&quot;YII&quot;&gt;YII&lt;/option&gt;
                &lt;option value=&quot;Zend&quot;&gt;Zend&lt;/option&gt;
                &lt;option value=&quot;Symfony&quot;&gt;Symfony&lt;/option&gt;
                &lt;option value=&quot;Phalcon&quot;&gt;Phalcon&lt;/option&gt;
                &lt;option value=&quot;Slim&quot;&gt;Slim&lt;/option&gt;
            &lt;/select&gt;
        &lt;/div&gt;
        &lt;div class=&quot;form-group&quot;&gt;
            &lt;input type=&quot;submit&quot; class=&quot;btn btn-primary&quot; name=&quot;submit&quot; value=&quot;Submit&quot; /&gt;
        &lt;/div&gt;
    &lt;/form&gt;
    
    &lt;/div&gt;
&lt;style&gt;
form#category_form {
    background: #f2f2f2;
    padding: 50px;
    width: 50%;
    margin: 0 auto;
}
.form-group {
    text-align: right;
}
button.multiselect.dropdown-toggle.btn.btn-default {
    border: 1px solid;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}


&lt;/style&gt;
&lt;/body&gt;
&lt;script&gt;
	$(document).ready(function(){
		$('#category').multiselect({
		nonSelectedText: 'Select category',
		enableFiltering: true,
		enableCaseInsensitiveFiltering: true,
		buttonWidth:'400px'
	});
	$('#category_form').on('submit', function(event){
		event.preventDefault();
		var form_data = $(this).serialize();
	$.ajaxSetup({
		headers: {
		'X-CSRF-TOKEN': $('meta&#x5B;name=&quot;csrf-token&quot;]').attr('content')
		}
	});
	$.ajax({
		url:&quot;{{ url('store') }}&quot;,
		method:&quot;POST&quot;,
		data:form_data,
		success:function(data)
	{
		$('#category option:selected').each(function(){
		$(this).prop('selected', false);
	});
		$('#category').multiselect('refresh');
		alert(data&#x5B;'success']);
	}
	});
	});
	});
&lt;/script&gt;
&lt;/html&gt;
</pre>
<h3>Step 7:- Run Development Server</h3>
<pre class="brush: php; title: ; notranslate">
php artisan serve
</pre>
<pre class="brush: php; title: ; notranslate">
http://127.0.0.1:8000/cat
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-multiselect-dropdown-with-checkbox-in-bootstrap-4/">Laravel 8 Multiselect Dropdown with Checkbox In Bootstrap 4</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/laravel-8-multiselect-dropdown-with-checkbox-in-bootstrap-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
