Files
rspade_system/app/RSpade/Lib/Flash/Flash_Alert_Model.php
root 1322bbf988 Add MODEL-CARBON-01 rule to prevent Carbon casts in models
Remove auto-generated tests and .expect files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-25 21:04:36 +00:00

87 lines
2.3 KiB
PHP

<?php
namespace App\RSpade\Lib\Flash;
use App\RSpade\Core\Database\Models\Rsx_Model_Abstract;
/**
* _AUTO_GENERATED_ Database type hints - do not edit manually
* Generated on: 2025-12-25 20:57:55
* Table: _flash_alerts
*
* @property int $id
* @property int $session_id
* @property int $type_id
* @property string $message
* @property string $created_at
* @property int $created_by
* @property int $updated_by
* @property string $updated_at
*
* @property-read string $type_id_label
* @property-read string $type_id_constant
* @property-read array $type_id_enum_val
*
* @method static array type_id_enum_val() Get all enum definitions with full metadata
* @method static array type_id_enum_select() Get selectable items for dropdowns
* @method static array type_id_enum_labels() Get simple id => label map
* @method static array type_id_enum_ids() Get array of all valid enum IDs
*
* @mixin \Eloquent
*/
class Flash_Alert_Model extends Rsx_Model_Abstract
{
/**
* _AUTO_GENERATED_ Enum constants
*/
const TYPE_SUCCESS = 1;
const TYPE_ERROR = 2;
const TYPE_INFO = 3;
const TYPE_WARNING = 4;
/** __AUTO_GENERATED: */
/** __/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';
}
}