'integer', ]; public function project(): BelongsTo { return $this->belongsTo(Project::class); } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function scopeNew($query) { return $query->where('status', 'new'); } public function scopeConsidered($query) { return $query->where('status', 'considered'); } public function scopePlanned($query) { return $query->where('status', 'planned'); } public function scopeRejected($query) { return $query->where('status', 'rejected'); } public function scopeImplemented($query) { return $query->where('status', 'implemented'); } public function scopeByCategory($query, string $category) { return $query->where('category', $category); } public function scopeLinkedToProject($query) { return $query->whereNotNull('project_id'); } public function scopeUnlinked($query) { return $query->whereNull('project_id'); } public function scopeSearch($query, string $search) { return $query->where('title', 'like', '%' . $search . '%') ->orWhere('description', 'like', '%' . $search . '%') ->orWhere('tags', 'like', '%' . $search . '%'); } public function getTagsArrayAttribute(): array { return $this->tags ? explode(',', $this->tags) : []; } public function setTagsAttribute(array|string|null $value): void { if (is_array($value)) { $this->attributes['tags'] = implode(',', $value); } else { $this->attributes['tags'] = $value; } } }