44 lines
1000 B
PHP
44 lines
1000 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $message_id
|
|
* @property int $user_id
|
|
* @property string $reaction
|
|
* @property \Carbon\Carbon $created_at
|
|
*/
|
|
class MessageReaction extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'message_id',
|
|
'user_id',
|
|
'reaction',
|
|
];
|
|
|
|
protected $casts = [
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
// ── Relationships ────────────────────────────────────────────────────────
|
|
|
|
public function message(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Message::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|