/** * @see \Colada\Option::from() * * @param mixed $value * * @return \Colada\Option */ function option($value) { return \Colada\Option::from($value); }
/** * @param callback $qbFilter * @param callback $nativeFilter * * @return \Colada\Option */ protected function findInQbBy($qbFilter, $nativeFilter) { Contracts::ensureCallable($qbFilter, $nativeFilter); if ($this->queryBuilder) { $queryBuilder = clone $this->queryBuilder; $alias = $queryBuilder->getRootAliases(); $alias = $alias[0]; call_user_func($qbFilter, $queryBuilder, $alias); $entity = $queryBuilder->getQuery()->getOneOrNullResult(); return \Colada\Option::from($entity); } else { return $this->findBy($nativeFilter); } }