/** * @param array $with * @return array|mixed */ public function index($id) { try { return $this->repository->with(['project'])->findWhere(['project_id' => $id]); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } catch (FatalErrorException $e) { return ['error' => true, 'message' => $e->getMessage()]; } }
public function showMember($id) { try { return $this->repository->with('members')->find($id); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => $e->getMessage()]; } }