module shop, flash message
This commit is contained in:
29
kernel/Flash.php
Normal file
29
kernel/Flash.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace kernel;
|
||||
|
||||
use Josantonius\Session\Facades\Session;
|
||||
|
||||
class Flash
|
||||
{
|
||||
|
||||
public static function setMessage(string $type, string $msg): void
|
||||
{
|
||||
Session::start();
|
||||
Session::set($type, $msg);
|
||||
}
|
||||
|
||||
public static function getMessage(string $type): string
|
||||
{
|
||||
$msg = Session::get($type, false);
|
||||
Session::remove($type);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
public static function hasMessage(string $type): bool
|
||||
{
|
||||
return Session::has($type);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user