Giter Site home page Giter Site logo

Comments (6)

juliomotol avatar juliomotol commented on June 9, 2024 1

Hi, I found the problem with the facades. the __destruct method is not triggered.

public function __destruct()
{
$this->flashConfig();
}

I then tried placing the $this->flashConfig() inside message() method and it works as intended.

from sweet-alert.

tkaarlas avatar tkaarlas commented on June 9, 2024

Having the same issue with Laravel 6.
Only way I get this to work is if I use alert()->message('Message', 'Optional Title'); and also session based swal() in my script section, which is yielded into main layout file.
For some reason in main layout file's script section the dynamic swal() doesn't do the job.

And Facade method triggers nothing. :/ (Plus, @include('sweet::alert') has to be in the main layout, otherwise it won't work either.)

I posted this comment here, but it's kinda related also to #93 and #115. I installed this via composer & npm, also tried with CDN. Also noticed that it didn't create its alias Alert by itself, so I had to use FQN.

from sweet-alert.

uxweb avatar uxweb commented on June 9, 2024

@tkaarlas @HazemAyyad

Looks like there's some bug related to the Facade. I'm digging into the code to find out the bug. All help is appreciated!

from sweet-alert.

juliomotol avatar juliomotol commented on June 9, 2024

Hi, Sharing some of my findings

First Controller Action

SweetAlert::error('Some error');

dd(Session::get('sweet_alert')); // Displays the sweet alert config

return redirect()->route('some-route');

'some-route' Controller action

dd(Session::get('sweet_alert')); // Displays 'null'

The helper alert()->error() doesn't work for me either. Im running Laravel 6.x. There might be some problems with the Session dependency or something has changed with how Laravel redirects. Will continue looking further and will update you when something comes up.

from sweet-alert.

rabishmuel avatar rabishmuel commented on June 9, 2024

THANKS "juliomotol" ! It's work for me !
-> I add "$this->flashConfig();" into the public function "message ()"

did you put "$this->flashConfig();" in the __destruct() or did you remove it?

from sweet-alert.

juliomotol avatar juliomotol commented on June 9, 2024

did you put "$this->flashConfig();" in the __destruct() or did you remove it?

Neither, I was just trying to figure out what could have been the problem and tried hacking the code a bit. I'd suggest using the helper functions for now until this is fixed.

from sweet-alert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.