How to Implement Sweet Alert in Laravel Application

How to Implement Sweet Alert in Laravel Application

In this Post We Will Explain About is How to Implement Sweet Alert in Laravel Application With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to use Sweet Alert to replace standard confirm dialog Example

In this post we will show you Best way to implement Sweet Alert Messages using laravel, hear for Laravel 5 – confirmation box for delete a member from database example with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Phase 1: Install uxweb/sweet-alert Package

composer require uxweb/sweet-alert

And then successfully this install package, after that open simple path config/app.php file and pur some service provider and alias source code.config/app.php

'providers' => [
	....
	UxWeb\SweetAlert\SweetAlertServiceProvider::class,
],
'aliases' => [
	....
	'Alert' => UxWeb\SweetAlert\SweetAlert::class,
]

As above We put simple “Alert” facade We can Display, but we do not any external libs require in this best example, so And then We just put for demo.

Phase 2: Add Route

routes/web.php

Route::get('my-livetoaster/{type}', 'LiveController@myLivetoaster');

Phase 3: Create Controller Method

so open your app/Http/Controllers/LiveController.phpfile and add following route.

message('live Sweet Alert with message Good Luck.');
                break;
            case 'basic':
                alert()->basic('live Sweet Alert with basic Good Luck.','Basic');
                break;
            case 'info':
                alert()->info('live Sweet Alert with info Good Luck.');
                break;
            case 'success':
                alert()->success('some Sweet Alert with success Good Luck.','Welcome to ItSolutionStuff.com')->autoclose(4000);
                break;
            case 'error':
                alert()->error('some Sweet Alert with error Good Luck.');
                break;
            case 'warning':
                alert()->warning('some Sweet Alert with warning Good Luck.');
                break;
            default:
                # your code...
                break;
        }

        return view('my-livetoaster');
    }
}

Phase 4: create Blade File

so open your resources/views/my-livetoaster.blade.phpfile and add following route.




	Pakainfo.com Laravel Sweet Alert Notification
	
	
	
	



Laravel Sweet Alert Notification step by step

@include('sweet::alert')

Live24u is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development. We deliver the useful and best tutorials for web professionals — developers, programmers, freelancers and site owners. Any visitors of this site are free to browse our tutorials, live demos and download scripts.

And then We are ready to some run our best example therefor run bellow some command run:

php artisan serve

And then We can open some bellow url on our browser:

https://www.pakainfo.com/my-livetoaster/success
https://www.pakainfo.com/my-livetoaster/basic
https://www.pakainfo.com/my-livetoaster/message

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Laravel 5 – confirmation box for delete a member from database example And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Comment