/** * Remove the specified resource from storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Contracts\Http\Response */ public function destroy(Request $request, $id) { $thing = $this->model->findOrFail($id); if (!$thing->delete()) { return $this->respond->internalError('Failed to delete !'); } return $this->respond->success('Deleted'); }
/** * Exposure a listing of the endpoints. * * @param \Appkr\Fractal\Http\Response $response * @return \Illuminate\Contracts\Http\Response */ public function index(Response $response) { $payload = ['resources' => route('v1.things.index'), 'authors' => route('v1.authors.index')]; return $response->setMeta(['message' => "Hello, I'm a appkr/fractal example api", 'version' => 1, 'documentation' => route('v1.doc')])->respond(['link' => $payload]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Contracts\Http\Response */ public function show($id) { return $this->respond->setMeta($this->meta)->withItem($this->model->with('things')->findOrFail($id), new AuthorTransformer()); }