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