Add 100+ automated unit tests from .expect file specifications Add session system test Add rsx:constants:regenerate command test Add rsx:logrotate command test Add rsx:clean command test Add rsx:manifest:stats command test Add model enum system test Add model mass assignment prevention test Add rsx:check command test Add migrate:status command test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
74 lines
1.9 KiB
PHP
74 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\RSpade\Lib\Flash;
|
|
|
|
use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
|
|
|
|
/**
|
|
* _AUTO_GENERATED_
|
|
* @property integer $id
|
|
* @property integer $session_id
|
|
* @property integer $type_id
|
|
* @property string $message
|
|
* @property \Carbon\Carbon $created_at
|
|
* @property integer $created_by
|
|
* @property integer $updated_by
|
|
* @property \Carbon\Carbon $updated_at
|
|
* @method static mixed type_id_enum()
|
|
* @method static mixed type_id_enum_select()
|
|
* @method static mixed type_id_enum_ids()
|
|
* @property-read mixed $type_id_constant
|
|
* @property-read mixed $type_id_label
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Flash_Alert_Model extends Rsx_Model_Abstract
|
|
{
|
|
/** __AUTO_GENERATED: */
|
|
const TYPE_SUCCESS = 1;
|
|
const TYPE_ERROR = 2;
|
|
const TYPE_INFO = 3;
|
|
const TYPE_WARNING = 4;
|
|
/** __/AUTO_GENERATED */
|
|
|
|
// Enum constants (auto-generated by rsx:migrate:document_models)
|
|
|
|
public static $enums = [
|
|
'type_id' => [
|
|
1 => ['constant' => 'TYPE_SUCCESS', 'label' => 'Success'],
|
|
2 => ['constant' => 'TYPE_ERROR', 'label' => 'Error'],
|
|
3 => ['constant' => 'TYPE_INFO', 'label' => 'Info'],
|
|
4 => ['constant' => 'TYPE_WARNING', 'label' => 'Warning'],
|
|
],
|
|
];
|
|
|
|
public static $rel = [];
|
|
|
|
protected $table = '_flash_alerts';
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Get the type as a string for client consumption
|
|
*
|
|
* @return string 'success'|'error'|'info'|'warning'
|
|
*/
|
|
public function get_type_string(): string
|
|
{
|
|
$type_map = [
|
|
self::TYPE_SUCCESS => 'success',
|
|
self::TYPE_ERROR => 'error',
|
|
self::TYPE_INFO => 'info',
|
|
self::TYPE_WARNING => 'warning',
|
|
];
|
|
|
|
return $type_map[$this->type_id] ?? 'info';
|
|
}
|
|
} |