PHP Laravel 5.6 Delete Multiple Rows using Checkbox

Today, We want to share with you PHP Laravel 5.6 Delete Multiple Rows using Checkbox.In this post we will show you php – Laravel 5.6 delete multiple checkbox, hear for Delete Multiple Data using Checkbox in Laravel 5.6 we will give you demo and example for implement.In this post, we will learn about How to Delete Multiple Records Using Laravel Eloquent with an example.

PHP Laravel 5.6 Delete Multiple Rows using Checkbox

There are the Following The simple About PHP Laravel 5.6 Delete Multiple Rows using Checkbox Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to delete multiple rows with checkbox using jquery ajax in PHP Laravel 5.6 with demo, so the some major files and Directory structures for this example is following below.

  • Create MySQL TABLE
  • Create Laravel Model
  • Controller
  • View
Read Also:  javascript countdown timer minutes seconds

Step1: Make database table

create a progammings table on MySQL

CREATE TABLE `progammings` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `progamming_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
 `progamming_details` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
 `updated_at` datetime DEFAULT NULL,

INSERT INTO `progammings` (`progamming_name`, `progamming_details`) VALUES
('Angularjs', 'Angularjs Tutorials'),
('MySQL', 'MySQL Tutorials'),
('Vuejs', 'Vuejs Tutorials'),
('Laravel', 'Laravel Tutorials'),
('Javascript', 'Javascript Tutorials');

app/Progamming.php – Model Class


namespace App;

use Illuminate\Database\Eloquent\Model;

class Progamming extends Model
    protected $fillable = [

Step 2: Include Laravel Routes


Route::get('progamming', '[email protected]');
Route::delete('progamming/{id}', ['as'=>'progamming.destroy','uses'=>'[email protected]']);
Route::delete('delete-multiple-progamming', ['as'=>'progamming.multiple-delete','uses'=>'[email protected]']);

Step 3: Make Progamming Laravel Controller


We shall make a Laravel 5.6 controller “ProgammingController.php” in following path this app/Http/Controllers/.

        return back()->with('success','Progamming deleted successfully');

    public function deleteMultiple(Request $request){
        $ids = $request->ids;
        return response()->json(['status'=>true,'message'=>"Progamming deleted successfully."]);


Step 4: Make a Laravel View Blade File


Read Also:  Laravel Delete Multiple Checkboxes Example


    <title>PHP Laravel 5.6 - How to delete multiple row with checkbox using Ajax?</title>


<div class="container">
    <h3>PHP Laravel 5.6 Delete Multiple Rows using Checkbox</h3>
    @if ($message = Session::get('success'))
    <div class="alert alert-success">
        <p>{{ $message }}</p>
    <button style="margin: 5px" class="pakainfo btn btn-danger btn-xs delete-all">Delete All</button>
    <table class="table table-bordered">
            <th>Progamming Name</th>
            <th>Progamming Details</th>
            <th width="100px">Action</th>
            @foreach($progammings as $key => $progamming)
                    <td>{{ ++$key }}</td>
                    <td>{{ $progamming->progamming_name }}</td>
                    <td>{{ $progamming->progamming_details }}</td>
                        {!! Form::open(['method' => 'DELETE','route' => ['progamming.destroy', $progamming->id],'style'=>'display:inline']) !!}

                            {!! Form::button('Delete', ['class' => 'btn btn-danger btn-xs','data-toggle'=>'confirmation','data-placement'=>'left']) !!}

                        {!! Form::close() !!}

    $(document).ready(function () {

        $('#select_all').on('click', function(e) {
            $(".checkbox").prop('checked', true);  
         } else {  

            if($('.checkbox:checked').length == $('.checkbox').length){

        $('.delete-all').on('click', function(e) {

            var allIds = [];  
            $(".checkbox:checked").each(function() {  

            if(allIds.length <=0)  
                alert("Please select atleast one record to delete.");  
            }  else {  

                if(confirm("Are you sure, you want to delete the selected progammings?")){  

                    var strIds = allIds.join(","); 

                        url: "{{ route('progamming.multiple-delete') }}",
                        type: 'DELETE',
                        headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
                        data: 'ids='+strIds,
                        success: function (data) {
                            if (data['status']==true) {
                                $(".checkbox:checked").each(function() {  
                            } else {
                                alert('Sorry, Whoops Something went wrong!!');
                        error: function (data) {


            rootSelector: '[data-toggle=confirmation]',
            onConfirm: function (event, element) {

Angular 6 CRUD Operations Application Tutorials

Read :

Read Also:  ErrorException in Builder.php[solution]


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Laravel 5.6 Delete Multiple Rows using Checkbox.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  jQuery Delete Multiple Rows using checkbox PHP with MySQL
  2. Read Also:  PHP Download Remote File from URL using CURL
  3. Read Also:  Mongodb Insert Update Delete – CRUD Operation using PHP & Mongodb
  4. Read Also:  jQuery AJAX laravel 6 Delete Data from database
  5. Read Also:  How to find the nth prime number in Java?
  6. Read Also:  gcd of two numbers in c using function
  7. Read Also:  Laravel requires the Mcrypt PHP extension
  8. Read Also:  Laravel 6 MySQL Get Last Inserted ID
  9. Read Also:  PHP Get User IP Address
  10. Read Also:  PHP Get User IP Address