This commit is contained in:
Saeed Vaziry
2023-07-02 12:47:50 +02:00
commit 5c72f12490
825 changed files with 41659 additions and 0 deletions

40
app/Helpers/Toast.php Normal file
View File

@ -0,0 +1,40 @@
<?php
namespace App\Helpers;
use Livewire\Component;
class Toast
{
public function __construct(public Component $component)
{
}
public function success(string $message): void
{
$this->toast('success', $message);
}
public function error(string $message): void
{
$this->toast('error', $message);
}
public function warning(string $message): void
{
$this->toast('warning', $message);
}
public function info(string $message): void
{
$this->toast('info', $message);
}
private function toast(string $type, string $message): void
{
$this->component->dispatchBrowserEvent('toast', [
'type' => $type,
'message' => $message,
]);
}
}