feat: Phase 5.2 - Global Search with Laravel Scout
- Install laravel/scout with database driver - Add Searchable trait to Feature, Issue, Task, Inspection models - Create GlobalSearch Livewire component with Blade view - Configure scout.php for database driver + queued syncing - Add SCOUT_DRIVER=database to .env.example Tests: 101 passing (319 assertions)
This commit is contained in:
+21
-1
@@ -7,10 +7,11 @@ use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Laravel\Scout\Searchable;
|
||||
|
||||
class Feature extends Model
|
||||
{
|
||||
use LogsActivity, SoftDeletes;
|
||||
use LogsActivity, SoftDeletes, Searchable;
|
||||
|
||||
const STATUSES = ['planned', 'started', 'in_progress', 'completed', 'verified'];
|
||||
|
||||
@@ -156,4 +157,23 @@ class Feature extends Model
|
||||
|
||||
return $spi >= 0.95;
|
||||
}
|
||||
|
||||
public function toSearchableArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'project_id' => $this->layer->phase->project_id ?? null,
|
||||
'phase_id' => $this->layer->phase_id ?? null,
|
||||
'layer_id' => $this->layer_id ?? null,
|
||||
'status' => $this->status,
|
||||
'progress' => $this->progress,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey(): string
|
||||
{
|
||||
return (string) $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user