Files
chatroom/app/Models/Message.php

48 lines
857 B
PHP
Raw Normal View History

<?php
/**
* 文件功能:聊天消息模型
*
* 对应原 ASP 文件:内存 Application("_says") 变量 (用数据库做持久化归档)
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'room_id',
'from_user',
'to_user',
'content',
'is_secret',
'font_color',
'action',
'sent_at',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'sent_at' => 'datetime',
'is_secret' => 'boolean',
];
}
}