mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
init
This commit is contained in:
40
app/Helpers/Toast.php
Normal file
40
app/Helpers/Toast.php
Normal 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,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user