/** * @param $id * @param bool $withRoles * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Support\Collection|null|static * @throws GeneralException */ public function findOrThrowException($id, $withRoles = false) { if (!is_null(Permission::find($id))) { if ($withRoles) { return Permission::with('roles')->find($id); } return Permission::find($id); } throw new GeneralException('That permission does not exist.'); }
/** * @param $id * @param bool $withRoles * @throws GeneralException * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Support\Collection|null|static */ public function findOrThrowException($id, $withRoles = false) { if (!is_null(Permission::find($id))) { if ($withRoles) { return Permission::with('roles')->find($id); } return Permission::find($id); } throw new GeneralException(trans('exceptions.backend.access.permissions.not_found')); }