/**
  * @param \Exception $e
  *
  * @return \Symfony\Component\HttpFoundation\Response
  *
  * @throws \Exception
  */
 public function getErrorResponse(\Exception $e)
 {
     if (config('app.debug')) {
         throw $e;
     }
     return parent::getErrorResponse($e);
 }
 public function testItCanGetWillReturnErrorResponse()
 {
     $callable = function () {
         throw new \Exception();
     };
     $response = $this->resource->get(10, $this->data, Post::class, $callable, $this->updateCallable);
     $this->assertInstanceOf(Response::class, $response);
     $this->assertEquals(400, $response->getStatusCode());
 }
 /**
  * @param Request $request
  * @param         $id
  *
  * @return Response
  */
 protected function patchAction(Request $request, $id)
 {
     $find = $this->findResourceCallable($id);
     $update = $this->updateResourceCallable();
     $resource = new PatchResource($this->serializer);
     return $this->addHeaders($resource->get($id, (array) $request->get('data'), get_class($this->getDataModel()), $find, $update));
 }
 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function patchAction(Request $request)
 {
     $resource = new PatchResource($this->serializer);
     $response = $resource->get($request->id, (array) $request->get('data'), get_class($this->getDataModel()), $this->findResourceCallable($request), $this->updateResourceCallable());
     return $this->addHeaders($response);
 }