forked from admin/services_core
update api ticket type
This commit is contained in:
@@ -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'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user