'decimal:2', 'max_m' => 'decimal:2', 'labor_price' => 'integer', 'is_active' => 'boolean', ]; /** * 상태별 필터 Scope */ public function scopeByStatus($query, string $status) { return $query->where('status', $status); } /** * 구분별 필터 Scope */ public function scopeByCategory($query, string $category) { return $query->where('category', $category); } /** * 검색 Scope */ public function scopeSearch($query, ?string $search) { if (empty($search)) { return $query; } return $query->where(function ($q) use ($search) { $q->where('labor_number', 'like', "%{$search}%") ->orWhere('category', 'like', "%{$search}%"); }); } }