public function index() { try { return $this->repository->with('projects')->all(); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'No data.']; } catch (\Exception $e) { return ['error' => true, 'message' => 'An error occurred when trying to update the data. Try again later.']; } }
public function index() { return $this->repository->with(['project'])->all(); }