Today, We want to share with you Laravel 6 Sweet Alert Tutorial With Example.In this post we will show you laravel 6 sweet alert confirm delete, hear for Inlining flash messages with the redirect() call in Laravel we will give you demo and example for implement.In this post, we will learn about Laravel: Display Flash Message after Registration or Login in Blade template with an example.
Laravel 6 Sweet Alert Tutorial With Example
There are the Following The simple About how to use sweetalert in laravel controller Full Information With Example and source code.
As I will cover this Post with live Working example to develop How to use sweetalert message box in laravel 6?, so the Display Sweet Alert in Laravel 6 using uxweb/sweet-alert is used for this example is following below.
Step 1: INSTALL LARAVEL 6 Web Application
install sweetalert2 laravel Project
composer create-project --prefer-dist laravel/laravel sweetalertexample
Step #2: Install Laravel 6 Sweet Alert Package
composer require uxweb/sweet-alert
in Laravel Added providers
'providers' => [ UxWeb\SweetAlert\SweetAlertServiceProvider::class, ];
in Laravel Added ‘aliases’
'aliases' => [ ‘Alert’ => UxWeb\SweetAlert\SweetAlert::class, ];
Step 3: Create a Laravel 6 Controller
php artisan make:controller NotificationController
NotificationController.php
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Alert; class NotificationController extends Controller { public function notification($type) { switch ($type) { case 'message': Alert::message('BookMyShow TamilRokers','Message'); break; case 'basic': Alert::basic('Grettings TamilRokers','Basic'); break; case 'info': Alert::info('Mail Sent TamilRokers successfully','Info'); break; case 'success': Alert::success('Your comments has been successfully sent', 'Success'); break; case 'error': Alert::error('Movis list went wrong.TamilRokers','Error'); break; case 'warning': Alert::warning('Please Enabled TamilRokers account','Warning'); break; default: break; } return view('sweetalert'); } }
Step 4: Define a Laravel 6 Route
routes/web.php
Route::get('sweetalert/{type}','[email protected]');
Step 5: Create a Laravel View Blade File
resources/views/sweetalert.blade.php
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>How to Implement Sweet Alert in Laravel Application - Tamilrokers</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.0/sweetalert.min.js"></script> </head> <body> <h2>How to Implement Sweet Alert in Laravel 6 Web Application</h2> @include('sweet::alert') <footer> <p>Posted by: Tamil Rokers</p> <p>Contact information: <a href="mailto:[email protected]"> [email protected]</a>.</p> </footer> </body> </html>
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about laravel 6 sweet alert confirm delete.
I would like to have feedback on my infinityknow.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.