Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Rashid Ali
Rashid Ali

Posted on

     

Laravel SweetAlert

Laravel SweetAlert

Laravel SweetAlert 2 is a Laravel package that integrates the popular JavaScript SweetAlert 2 with Laravel.

Using the package’s Alert facade or alert() helper, you can queue up SweetAlert 2 alerts on the frontend from your controller:

It so easy to implement and easy to use give a shot and leave your thoughts.

Install

To get started with Laravel SweetAlert,
use Composer to add the package to your project's dependencies:

composer require realrashid/sweet-alert

Alert

  • alert('Title','Lorem Lorem Lorem', 'success');

  • alert()->success('Title','Lorem Lorem Lorem');

  • alert()->info('Title','Lorem Lorem Lorem');

  • alert()->warning('Title','Lorem Lorem Lorem');

  • alert()->question('Title','Lorem Lorem Lorem');

  • alert()->error('Title','Lorem Lorem Lorem');

  • alert()->html('<i>HTML</i> <u>example</u>'," You can use <b>bold text</b>, <a href='//github.com'>links</a> and other HTML tags ",'success');

Toast

  • toast('Your Post as been submited!','success','top-right');

You can also configure the package’s ToSweetAlert middleware to handle SweetAlert 2 messages during a middleware handler:

public function someFunction(Request $request){    return redirect('login')->with('success', 'Login Successfully!');}

You should check out theDocumentation to see what methods are available.
You can learn more about this package and check out the source code on GitHub atrealrashid/sweet-alert

Featured On

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I’m a #PHP #Laravel #Developer who loves to create web applications that are fast, secure, and user-friendly.
  • Location
    Karachi
  • Work
    Laravel Developer at Fossphorus
  • Joined

More fromRashid Ali

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp