/** * @param $id * * @return mixed */ public function get($id) { $country = $this->repository->findBy('_id', $id); if (!$country) { throw new StoreResourceFailedException('Country not found'); } return $this->response->item($country, new BaseTransformer()); }
/** * @param $code * * @return mixed */ protected function validCountry($code) { $country = $this->countryRepository->findBy('code', $code); if (!$country) { throw new UpdateResourceFailedException("Country '{$code}' not found"); } return true; }