vito/app/Helpers/Toast.php
Saeed Vaziry b2083fc6b2
Migrate to HTMX (#114)
Dropped Livewire
Added HTMX
Added Blade code lint
Drop Mysql and Redis
Migrate to SQLite
2024-03-06 17:02:59 +01:00

33 lines
641 B
PHP

<?php
namespace App\Helpers;
class Toast
{
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
{
session()->flash('toast.type', $type);
session()->flash('toast.message', $message);
}
}