Easily Add SweetAlert into Laravel Application

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 40

  • @RashidAli-pb9lr
    @RashidAli-pb9lr 5 лет назад +29

    Hi,
    First of all thank you for the wonderful review!
    I am the author of this package,
    i think you forgot the middleware that's come with this package with the help of middleware you don't need to create constructor in extended controller also there's no need for if statement too.
    Using the Middleware
    First thing first Let register the middleware in web middleware groups by simply adding the middleware class \RealRashid\SweetAlert\ToSweetAlert::class,
    into the $middlewareGroups of your app/Http/Kernel.php class.
    Examples
    Now within your controllers, just set your return message and send the proper message and proper type.
    public function FunctionName(Request $request)
    {
    return redirect('index')->with('success', 'Task Created Successfully!');
    // OR
    return redirect('index')->withSuccess('Task Created Successfully!');
    }
    for more info check out the documentation middleware section.
    realrashid.github.io/sweet-alert/

    • @LaravelDaily
      @LaravelDaily  5 лет назад +5

      Thanks a lot Rashid! I've pinned your comment on top of all the comments so people would see that important information, sorry I missed it, maybe it wasn't that clear from the documentation.

    • @RashidAli-pb9lr
      @RashidAli-pb9lr 5 лет назад +2

      @@LaravelDaily in next release i will make documentation more clear.
      I am also adding cdn support and more helper methods.

    • @erenergul1772
      @erenergul1772 4 года назад +1

      @@RashidAli-pb9lr How do you handle delete confirmation from Controller ? How do we handle it with that package ? I didn't find any proper answer all over internet.

    • @judeartthaddeuslamberang6156
      @judeartthaddeuslamberang6156 2 года назад

      @@erenergul1772 up

    • @sugumar.v3962
      @sugumar.v3962 2 года назад +1

      thank you rashid ali bhai for adding sweat alert

  • @elfkampher
    @elfkampher 5 лет назад +5

    how do you handle a confirmation or cancel button whit this?

  • @rh3lix
    @rh3lix 5 лет назад

    The other way to validate the session is in your master layout file. So you can validate if the sesion is success/error then display the message by firing the Alert function. For me it is more simple than touching the base controller + middleware thing. :)

    • @PovilasKorop
      @PovilasKorop 5 лет назад

      Yes but then you can't do "use Alert;" and need to add all path \Something\Something\Alert::success('', '') which doesn't feel convenient either. That's kind of the whole point of this package - to not touch front-end, and perform all logic only in back-end files.

  • @ariel5515
    @ariel5515 5 лет назад +2

    Wow thats really cool, Personally I love to use SweetAlert2 and Javascript it´s so cool, but definitely this way it´s much cleaner, thanks! you always have great tuts!

  • @mosesket
    @mosesket 4 месяца назад

    can it be used in livewire, like can the middleware work in livewire validation

  • @extraordinary7660
    @extraordinary7660 4 года назад

    Thanks for the video.... but how we send email through sweetalert by clicked "ok"? thx

  • @goncalo05
    @goncalo05 3 года назад

    Hy man, how can I change the fadeout time?

  • @johnwesley2090
    @johnwesley2090 Год назад

    hi. does this work in laravel 10.

  • @devaes
    @devaes 4 года назад

    do you have vid for delete confirmation using that method ?

    • @PovilasKorop
      @PovilasKorop 4 года назад

      I don't have a video but you can google "sweetalert confirm", here's what I've found: stackoverflow.com/questions/31136889/how-to-use-confirm-using-sweet-alert

    • @shadowrealms2676
      @shadowrealms2676 2 года назад

      @@PovilasKorop Does this works with real rashid version?

  • @softwareEngineerKunwar
    @softwareEngineerKunwar 3 года назад

    how to add sweet alert on laravel 8 and vue.js 3

  • @_kaan
    @_kaan 5 лет назад

    Finally! thank you so much.

  • @ABHISHEKKUMAR-ne3rk
    @ABHISHEKKUMAR-ne3rk 4 года назад

    How we send otp in mobile or email

  • @teamadevelopment
    @teamadevelopment 5 лет назад

    Now this is a really great help! KUDOS!!!!! :D

  • @bibhasash7371
    @bibhasash7371 4 года назад

    Not working in my case...I have made a folder Backend inside my controllers folder and I created all necessary controllers in that Backend Folder... I'm Including it to my master.blade.php and do just like you but not working

    • @bibhasash7371
      @bibhasash7371 4 года назад

      Finally I did it

    • @samahaoum8688
      @samahaoum8688 4 года назад

      @@bibhasash7371 how

    • @bibhasash7371
      @bibhasash7371 4 года назад

      It worked

    • @samahaoum8688
      @samahaoum8688 4 года назад

      @@bibhasash7371 it woked for me too , but now i create another projet and when i display it , it doesnt it blocked my page

  • @bevedel
    @bevedel 4 года назад

    Thank you for great tut!

  • @bibhasash7371
    @bibhasash7371 4 года назад

    And I can't understand where exactly the error

  • @josealberto5266
    @josealberto5266 3 года назад

    how can use this to delete confirm,
    i mean = ¿are you sure you want delete this item ¡?

  • @allacarini
    @allacarini 3 года назад

    Thanks a lot.

  • @samahaoum8688
    @samahaoum8688 4 года назад

    it woked thank you

  • @vaiz151
    @vaiz151 4 года назад

    THANKS MASTER

  • @alexanderdera1266
    @alexanderdera1266 5 лет назад

    Thanks

  • @sultankydyrkozha
    @sultankydyrkozha 3 года назад

    Misunderstandable, have a nice day!

  • @sugumar.v3962
    @sugumar.v3962 2 года назад

    thank you for the wonderful review!