示例#1
0
/**
 * @see \Colada\Option::from()
 *
 * @param mixed $value
 *
 * @return \Colada\Option
 */
function option($value)
{
    return \Colada\Option::from($value);
}
示例#2
0
 /**
  * @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);
     }
 }