38 lines
844 B
PHP
38 lines
844 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $comment_id
|
|
* @property int $user_id
|
|
* @property string $reaction ReactionType slug (e.g. thumbs_up, heart, fire…)
|
|
*/
|
|
class CommentReaction extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $table = 'comment_reactions';
|
|
|
|
protected $fillable = ['comment_id', 'user_id', 'reaction'];
|
|
|
|
protected $casts = [
|
|
'comment_id' => 'integer',
|
|
'user_id' => 'integer',
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
public function comment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ArtworkComment::class, 'comment_id');
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|