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:
+24
-1
@@ -5,10 +5,11 @@ namespace App\Models;
|
||||
use App\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Laravel\Scout\Searchable;
|
||||
|
||||
class Issue extends Model
|
||||
{
|
||||
use LogsActivity, SoftDeletes;
|
||||
use LogsActivity, SoftDeletes, Searchable;
|
||||
|
||||
const STATUSES = ['open', 'in_review', 'resolved', 'closed'];
|
||||
|
||||
@@ -141,4 +142,26 @@ class Issue extends Model
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
|
||||
public function toSearchableArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'project_id' => $this->project_id,
|
||||
'feature_id' => $this->feature_id,
|
||||
'inspection_id' => $this->inspection_id,
|
||||
'status' => $this->status,
|
||||
'priority' => $this->priority,
|
||||
'type' => $this->type,
|
||||
'reported_by' => $this->reported_by,
|
||||
'assigned_to' => $this->assigned_to,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey(): string
|
||||
{
|
||||
return (string) $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user