1
0

update api ticket type

This commit is contained in:
Wian Drs
2026-06-25 17:11:48 +07:00
parent ad472a9880
commit af1c98b38b
29 changed files with 1097 additions and 34 deletions
+38 -7
View File
@@ -6,19 +6,50 @@ use App\Models\TicketType;
class TicketTypeService
{
public function list(array $filters = [])
{
return TicketType::query()
->when(
!empty($filters['search']),
fn($q) => $q->where(function ($x) use ($filters) {
$x->where(
'code',
'ILIKE',
"%{$filters['search']}%"
)
->orWhere(
'name',
'ILIKE',
"%{$filters['search']}%"
);
})
)
->latest('id')
->paginate(
$filters['per_page'] ?? 10
);
}
public function create(array $data): TicketType
{
return TicketType::create($data);
}
public function update(TicketType $type, array $data): TicketType
{
$type->update($data);
return $type->fresh();
public function update(
TicketType $ticketType,
array $data
): TicketType {
$ticketType->update($data);
return $ticketType->fresh();
}
public function delete(TicketType $type): bool
{
return $type->delete();
public function delete(
TicketType $ticketType
): bool {
return $ticketType->delete();
}
}