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
@@ -18,21 +18,24 @@ class TicketTypeController extends ApiController
public function index(Request $request)
{
$data = TicketType::latest()->paginate(
$request->get('per_page', 10)
$data = $this->service->list(
$request->all()
);
return $this->success($data);
return $this->success(
TicketTypeResource::collection($data),
'Data Ticket Type berhasil diambil'
);
}
public function store(StoreTicketTypeRequest $request)
{
$type = $this->service->create(
$data = $this->service->create(
$request->validated()
);
return $this->created(
new TicketTypeResource($type),
new TicketTypeResource($data),
'Ticket Type berhasil dibuat'
);
}
@@ -40,7 +43,8 @@ class TicketTypeController extends ApiController
public function show(TicketType $ticket_type)
{
return $this->success(
new TicketTypeResource($ticket_type)
new TicketTypeResource($ticket_type),
'Detail Ticket Type berhasil diambil'
);
}
@@ -48,13 +52,13 @@ class TicketTypeController extends ApiController
UpdateTicketTypeRequest $request,
TicketType $ticket_type
) {
$type = $this->service->update(
$data = $this->service->update(
$ticket_type,
$request->validated()
);
return $this->updated(
new TicketTypeResource($type),
new TicketTypeResource($data),
'Ticket Type berhasil diupdate'
);
}
@@ -67,4 +71,4 @@ class TicketTypeController extends ApiController
'Ticket Type berhasil dihapus'
);
}
}
}