allowedFilters(['id', 'currency_code']) ->allowedIncludes($this->allowedIncludes(self::INCLUDES)) ->allowedSorts(['id', 'created_at', 'updated_at', 'currency_code']) ->simplePaginate(request('per_page', 15)); // Return the ticketMessages as a JSON response return TicketMessageResource::collection($ticketMessages); } /** * Create a new ticketMessage */ public function store(CreateTicketMessageRequest $request) { // Validate and create the ticketMessage $ticketMessage = TicketMessage::create($request->validated()); // Return the created ticketMessage as a JSON response return new TicketMessageResource($ticketMessage); } /** * Show a specific ticketMessage */ public function show(GetTicketMessageRequest $request, TicketMessage $ticketMessage) { $ticketMessage = QueryBuilder::for(TicketMessage::class) ->allowedIncludes($this->allowedIncludes(self::INCLUDES)) ->findOrFail($ticketMessage->id); // Return the ticketMessage as a JSON response return new TicketMessageResource($ticketMessage); } /** * Delete a specific ticketMessage */ public function destroy(DeleteTicketMessageRequest $request, TicketMessage $ticketMessage) { // Delete the ticketMessage $ticketMessage->delete(); return $this->returnNoContent(); } }