Today, We want to share with you Laravel 5.7 Delete Confirm Bootstrap jQuery Model.In this post we will show you Delete Modal Popup with Laravel 5.7, Bootstrap and jQuery, hear for Laravel 5.7 – Confirmation before delete record from database example we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 – confirmation box for delete a member from database with an example.
Laravel 5.7 Delete Confirm Bootstrap jQuery Model
There are the Following The simple About Laravel 5.7 Delete Confirm Bootstrap jQuery Model Full Information With Example and source code.
As I will cover this Post with live Working example to develop , so the Use bootstrap dynamic modal for delete confirmation (laravel 5.7) for this example is following below.
Step : 1 Define Route
routes/web.php
Route::get('products', 'ProductController@index')->name('products'); Route::delete('products/{id}', 'ProductController@destroy')->name('product-delete');
Step : 2 Create Laravel Controller
app/Http/Controllers/ProductController.php file in
namespace App\Http\Controllers; use Illuminate\Http\Request; use DB; use Session; class ProductController extends Controller { /** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function index() { $products = DB::table("products")->get(); return view('products',compact('products')); } /** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function destroy($id) { DB::table("products")->delete($id); Session::put('success', 'Your Record Deleted Successfully.'); return redirect()->route('products'); } }
Step : 3 Define a Laravel blade/view File
resources/views/product.blade.php
@extends('layouts.app') @section('content')@endsection @section('script') @endsection@if ($message = Session::get('success')){!! $message !!}@endifAll Posts
@foreach($product as $key => $value) Title Description Action @endforeach {!! $value->title !!} {!! $value->description !!} id) !!}" data-id="{{$value->id}}" data-target="#product-default-width-modal">Delete
Step : 4 Main product-default.js File include
public/product-default.js
$(document).ready(function(){ // For A Delete Record Popup $('.remove-record').click(function() { var id = $(this).attr('data-id'); var url = $(this).attr('data-url'); var token = CSRF_TOKEN; $(".product-delete-record-model").attr("action",url); $('body').find('.product-delete-record-model').append(''); $('body').find('.product-delete-record-model').append(''); $('body').find('.product-delete-record-model').append(''); }); $('.remove-data-from-delete-form').click(function() { $('body').find('.product-delete-record-model').find( "input" ).remove(); }); $('.modal').click(function() { // $('body').find('.product-delete-record-model').find( "input" ).remove(); }); });
Run Laravel Project
php artisan serve http://localhost:8000/products
Angular 6 CRUD Operations Application Tutorials
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about Laravel 5.7 Delete Confirm Bootstrap jQuery Model.
I would like to have feedback on my Pakainfo.com 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.