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:
@@ -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 Inspection extends Model
|
||||
{
|
||||
use LogsActivity, SoftDeletes;
|
||||
use LogsActivity, SoftDeletes, Searchable;
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
@@ -87,4 +88,25 @@ class Inspection extends Model
|
||||
{
|
||||
return $q->where('status', 'rejected');
|
||||
}
|
||||
|
||||
public function toSearchableArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'project_id' => $this->project_id,
|
||||
'layer_id' => $this->layer_id,
|
||||
'feature_id' => $this->feature_id,
|
||||
'template_id' => $this->template_id,
|
||||
'user_id' => $this->user_id,
|
||||
'inspector_user_id' => $this->inspector_user_id,
|
||||
'status' => $this->status,
|
||||
'result' => $this->result,
|
||||
'notes' => $this->notes,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey(): string
|
||||
{
|
||||
return (string) $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user