Files
SkinbaseNova/app/Models/ArtworkReaction.php
klevze 31c87e4977 Move model observers onto attributes and tidy provider bindings.
Register observers with ObservedBy, bind the comment spam classifier, and keep AppServiceProvider focused on application wiring.
2026-09-20 14:49:00 +02:00

41 lines
956 B
PHP

<?php
namespace App\Models;
use App\Observers\ArtworkReactionObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
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…)
*/
#[ObservedBy([ArtworkReactionObserver::class])]
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);
}
}