$animethemes * @property int $group_id * @property string $name * @property string $slug * * @method static GroupFactory factory(...$parameters) */ #[Table(Group::TABLE, Group::ATTRIBUTE_ID)] class Group extends BaseModel implements Auditable, SoftDeletable { use HasAudits; use HasFactory; use SoftDeletes; final public const string TABLE = 'groups'; final public const string ATTRIBUTE_ID = 'group_id'; final public const string ATTRIBUTE_NAME = 'name'; final public const string ATTRIBUTE_SLUG = 'slug'; final public const string RELATION_ANIME = 'animethemes.anime'; final public const string RELATION_THEMES = 'animethemes'; final public const string RELATION_VIDEOS = 'animethemes.animethemeentries.videos'; /** * The event map for the model. * * Allows for object-based events for native Eloquent events. * * @var array */ protected $dispatchesEvents = [ 'created' => GroupCreated::class, 'deleted' => GroupDeleted::class, 'restored' => GroupRestored::class, 'updated' => GroupUpdated::class, ]; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ Group::ATTRIBUTE_NAME, Group::ATTRIBUTE_SLUG, ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ Group::ATTRIBUTE_NAME => 'string', Group::ATTRIBUTE_SLUG => 'string', ]; } public function getName(): string { return $this->name; } public function getSubtitle(): string { return $this->slug; } /** * @return HasMany */ public function animethemes(): HasMany { return $this->hasMany(AnimeTheme::class, AnimeTheme::ATTRIBUTE_GROUP); } }