allowedIncludes(self::ALLOWED_INCLUDES) ->allowedFilters(self::ALLOWED_FILTERS); return $query->paginate($request->input('per_page') ?? 50); } /** * Display the specified resource. * * @param Server $server * @return Server|Collection|Model */ public function show(Server $server) { $query = QueryBuilder::for(Server::class) ->where('id', '=', $server->id) ->allowedIncludes(self::ALLOWED_INCLUDES); return $query->firstOrFail(); } /** * Remove the specified resource from storage. * * @param Server $server * @return Server */ public function destroy(Server $server) { $server->delete(); return $server; } /** * suspend server * * @param Server $server * @return Server|JsonResponse */ public function suspend(Server $server) { try { $server->suspend(); } catch (Exception $exception) { return response()->json(['message' => $exception->getMessage()], 500); } return $server->load('product'); } /** * unsuspend server * * @param Server $server * @return Server|JsonResponse */ public function unSuspend(Server $server) { try { $server->unSuspend(); } catch (Exception $exception) { return response()->json(['message' => $exception->getMessage()], 500); } return $server->load('product'); } }