Initial Release v1.0.0: Full feature set with Docker automation, Nginx/Alpine stack

This commit is contained in:
dyzulk
2026-01-16 11:21:32 +07:00
commit 45623973a8
139 changed files with 24302 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
<?php
namespace App\Helpers;
class FlashHelper {
const SESSION_KEY = 'flash_notification';
/**
* Set a flash message.
*
* @param string $type Notification type: 'success', 'error', 'warning', 'info', 'question'
* @param string $title Title of the notification (or i18n key)
* @param string $message (Optional) Body text of the notification (or i18n key)
* @param array $params (Optional) Parameters for translation interpolation
* @param bool $isTranslated Whether to treat title and message as translation keys
*/
public static function set($type, $title, $message = null, $params = [], $isTranslated = false) {
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
$_SESSION[self::SESSION_KEY] = [
'type' => $type,
'title' => $title,
'message' => $message,
'params' => $params,
'isTranslated' => $isTranslated
];
}
/**
* Check if a flash message exists.
*
* @return boolean
*/
public static function has() {
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
return isset($_SESSION[self::SESSION_KEY]);
}
/**
* Get the flash message and clear it from session.
*
* @return array|null
*/
public static function get() {
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (self::has()) {
$notification = $_SESSION[self::SESSION_KEY];
unset($_SESSION[self::SESSION_KEY]);
return $notification;
}
return null;
}
}