/** * @param $id * @return \Illuminate\Http\JsonResponse|mixed */ public function show($id) { try { return $this->repository->hidden(['owner_id', 'client_id'])->with(['owner', 'client'])->find($id); } catch (ModelNotFoundException $e) { return response()->json([$e->getMessage()], 404); } //QueryException tratado em Exceptions/Handler.php }
/** * Display a listing of the resource. * * @return Response */ public function index() { return $this->repository->hidden(['owner_id', 'client_id'])->with(['owner', 'client'])->all(); }