本文整理匯總了PHP中Eloquent::newQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP Eloquent::newQuery方法的具體用法?PHP Eloquent::newQuery怎麽用?PHP Eloquent::newQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Eloquent
的用法示例。
在下文中一共展示了Eloquent::newQuery方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: newQuery
public function newQuery($excludeDeleted = true)
{
$raw = '';
foreach ($this->geofields as $column) {
$raw .= ' astext(' . $column . ') as ' . $column . ' ';
}
return parent::newQuery($excludeDeleted)->addSelect('*', \DB::raw($raw));
}
示例2: newQuery
public function newQuery($excludeDeleted = true)
{
$builder = parent::newQuery($excludeDeleted);
// If I am using STI, and I am not the base class,
// then filter on the class name.
if ($this->useSti() && get_class(new $this->stiBaseClass()) !== get_class($this)) {
$builder->where($this->stiClassField, "=", get_class($this));
}
return $builder;
}
示例3: newQuery
/**
* @return \Illuminate\Database\Eloquent\Builder
*/
public function newQuery()
{
$query = parent::newQuery();
$query->defaultSort();
return $query;
}
示例4: getById
public function getById($id)
{
return $this->applyEagerLoads($this->model->newQuery())->get($id);
}
示例5: newQuery
/**
* Default orderBy created_at DESC
**/
public function newQuery()
{
return parent::newQuery()->orderBy('created_at', 'DESC');
}