Register observers with ObservedBy, bind the comment spam classifier, and keep AppServiceProvider focused on application wiring.
35 lines
789 B
PHP
35 lines
789 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Observers\GroupReleaseContributorObserver;
|
|
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[ObservedBy([GroupReleaseContributorObserver::class])]
|
|
class GroupReleaseContributor extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'group_release_id',
|
|
'user_id',
|
|
'role_label',
|
|
'sort_order',
|
|
];
|
|
|
|
public function release(): BelongsTo
|
|
{
|
|
return $this->belongsTo(GroupRelease::class, 'group_release_id');
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|