mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-21 02:41:36 +00:00
38 lines
717 B
PHP
38 lines
717 B
PHP
<?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->dispatch('toast', type: $type, message: $message);
|
|
}
|
|
}
|