igmf/kernel/Flash.php

39 lines
674 B
PHP
Raw Permalink Normal View History

2024-10-17 14:55:00 +03:00
<?php
namespace kernel;
use Josantonius\Session\Facades\Session;
class Flash
{
public static function setMessage(string $type, string $msg): void
{
2025-01-28 16:44:34 +03:00
self::start();
2024-10-17 14:55:00 +03:00
Session::set($type, $msg);
}
public static function getMessage(string $type): string
{
2025-01-28 16:44:34 +03:00
self::start();
2024-10-17 14:55:00 +03:00
$msg = Session::get($type, false);
Session::remove($type);
return $msg;
}
public static function hasMessage(string $type): bool
{
2025-01-28 16:44:34 +03:00
self::start();
2024-10-17 14:55:00 +03:00
return Session::has($type);
}
2025-01-28 16:44:34 +03:00
public static function start()
{
if (!Session::isStarted()){
Session::start();
}
}
2024-10-17 14:55:00 +03:00
}