'int', 'rules' => 'array', ]; protected $appends = ['is_smart']; public function songs(): BelongsToMany { return $this->belongsToMany(Song::class); } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function getIsSmartAttribute(): bool { return (bool) $this->rules; } /** @return array */ public function toSearchableArray(): array { return [ 'id' => $this->id, 'name' => $this->name, ]; } }