1
0

big update base struktur tahap 1

This commit is contained in:
Wian Drs
2026-07-27 16:24:09 +07:00
parent 2b3592c4c2
commit 1dd02baa72
169 changed files with 24405 additions and 977 deletions
@@ -6,16 +6,29 @@ use App\Models\TicketIncidentType;
class TicketIncidentTypeService
{
public function getAll()
public function list(array $filters = [])
{
return TicketIncidentType::orderBy('name')->get();
return TicketIncidentType::query()
->when(
! empty($filters['search']),
fn ($query) => $query->where('name', 'ILIKE', "%{$filters['search']}%")
)
->when(
array_key_exists('is_active', $filters) && $filters['is_active'] !== '',
fn ($query) => $query->where(
'is_active',
filter_var($filters['is_active'], FILTER_VALIDATE_BOOLEAN)
)
)
->orderBy('name')
->paginate($filters['per_page'] ?? 10);
}
public function create(array $data): TicketIncidentType
{
return TicketIncidentType::create([
'name' => $data['name'],
'is_active' => $data['is_active'] ?? true
'is_active' => $data['is_active'] ?? true,
]);
}
@@ -25,7 +38,7 @@ class TicketIncidentTypeService
): TicketIncidentType {
$ticketIncidentType->update([
'name' => $data['name'],
'is_active' => $data['is_active']
'is_active' => $data['is_active'],
]);
return $ticketIncidentType->fresh();
@@ -35,4 +48,4 @@ class TicketIncidentTypeService
{
$ticketIncidentType->delete();
}
}
}