39 lines
		
	
	
		
			674 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			674 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace kernel;
 | 
						|
 | 
						|
use Josantonius\Session\Facades\Session;
 | 
						|
 | 
						|
class Flash
 | 
						|
{
 | 
						|
 | 
						|
    public static function setMessage(string $type, string $msg): void
 | 
						|
    {
 | 
						|
        self::start();
 | 
						|
        Session::set($type, $msg);
 | 
						|
    }
 | 
						|
 | 
						|
    public static function getMessage(string $type): string
 | 
						|
    {
 | 
						|
        self::start();
 | 
						|
        $msg = Session::get($type, false);
 | 
						|
        Session::remove($type);
 | 
						|
 | 
						|
        return $msg;
 | 
						|
    }
 | 
						|
 | 
						|
    public static function hasMessage(string $type): bool
 | 
						|
    {
 | 
						|
        self::start();
 | 
						|
 | 
						|
        return Session::has($type);
 | 
						|
    }
 | 
						|
 | 
						|
    public static function start()
 | 
						|
    {
 | 
						|
        if (!Session::isStarted()){
 | 
						|
            Session::start();
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
} |