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.
This commit is contained in:
test
2026-09-20 14:49:00 +02:00
parent 3078319f3c
commit 5437f84c4c
9 changed files with 336 additions and 250 deletions
+8 -5
View File
@@ -2,15 +2,18 @@
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…)
* @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;
@@ -21,7 +24,7 @@ class ArtworkReaction extends Model
protected $casts = [
'artwork_id' => 'integer',
'user_id' => 'integer',
'user_id' => 'integer',
'created_at' => 'datetime',
];