jantinnerezo / livewire-alert

SweetAlert2 wrapper for Livewire
https://livewire-alert.jantinnerezo.com
MIT License
709 stars 73 forks source link

Passing method parametres to alert error #42

Closed hamza-topo closed 2 years ago

hamza-topo commented 3 years ago

hi folks !


i have a laravel 8 project ; and im using your wrapper (livewire-alert) to show sweet alert . and it's works as expected for info,success types .

what im trying to do now is to add an undo action to this sweet alert so i can be able to restore the action of delete ( restore user from trash for example ) via event listener .

to do that i need to add a parametre "method" to my sweetAlert properties,contain my event listener .

but the console shows that

SweetAlert2: Unknown parameter "method".

here is my code : MyClass{ public $properties = [ 'position' => 'top-end', 'timer' => 30000, 'toast' => true, 'confirmButtonText' => 'Ok', 'showCancelButton' => true, 'showConfirmButton' => false, ];

//function that fire the alert

public function show(){

     if ($callback != null){
        $this->properties['method'] = $callback;
        unset($this->properties['confirmButtonText']);
    }
    $this->alert($this->type='warning', $this->message='something important', $this->properties);

unknown

}

}

lukebouch commented 3 years ago

I'm trying to figure out have to do the same thing.

jantinnerezo commented 2 years ago

Hi @hamza-topo, should be documented on the next release, sorry for the very late reply.