32 lines
534 B
PHP
32 lines
534 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Message extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id',
|
|
'receiver_id',
|
|
'body',
|
|
'attachment',
|
|
'attachment_type',
|
|
'read_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'read_at' => 'datetime',
|
|
];
|
|
|
|
public function sender()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function receiver()
|
|
{
|
|
return $this->belongsTo(User::class, 'receiver_id');
|
|
}
|
|
}
|