Ejemplo n.º 1
0
 /**
  * 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');
 }
Ejemplo n.º 2
0
 /**
  * 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]);
 }
Ejemplo n.º 3
0
 /**
  * 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());
 }