*/ use HasFactory; protected function casts(): array { return [ 'tags' => 'array', 'featured' => 'boolean', 'approved' => 'boolean', ]; } protected static function booted(): void { static::creating(function (Skill $skill) { if (empty($skill->slug)) { $skill->slug = Str::slug($skill->name); } }); } /** * @return BelongsTo */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * @param Builder $query */ #[Scope] protected function approved(Builder $query): void { $query->where('approved', true); } protected function categoryLabel(): Attribute { return Attribute::get(fn () => config("skills.categories.{$this->category}", $this->category)); } }