model = $courier; } /** * Create the courier * * @param array $params * @return Courier * @throws CourierInvalidArgumentException */ public function createCourier(array $params) : Courier { try { return $this->create($params); } catch (QueryException $e) { throw new CourierInvalidArgumentException($e->getMessage()); } } /** * Update the courier * * @param array $params * * @return bool * @throws CourierInvalidArgumentException */ public function updateCourier(array $params) : bool { try { return $this->update($params); } catch (QueryException $e) { throw new CourierInvalidArgumentException($e->getMessage()); } } /** * Return the courier * * @param int $id * * @return Courier * @throws CourierNotFoundException */ public function findCourierById(int $id) : Courier { try { return $this->findOneOrFail($id); } catch (ModelNotFoundException $e) { throw new CourierNotFoundException('Courier not found.'); } } /** * Return all the couriers * * @param string $order * @param string $sort * @return Collection|mixed */ public function listCouriers(string $order = 'id', string $sort = 'desc') : Collection { return $this->all(['*'], $order, $sort); } /** * @return bool * @throws \Exception */ public function deleteCourier() { return $this->delete(); } }