Files
beatbook/app/Models/Message.php
T
2026-09-12 21:18:19 +01:00

26 lines
502 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
protected $fillable = ['from_user_id', 'to_user_id', 'subject', 'body', 'status', 'read_at'];
protected function casts(): array
{
return ['read_at' => 'datetime'];
}
public function fromUser()
{
return $this->belongsTo(User::class, 'from_user_id');
}
public function toUser()
{
return $this->belongsTo(User::class, 'to_user_id');
}
}