当前位置: 首页>>代码示例>>PHP>>正文


PHP static::newQuery方法代码示例

本文整理汇总了PHP中static::newQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP static::newQuery方法的具体用法?PHP static::newQuery怎么用?PHP static::newQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


在下文中一共展示了static::newQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: withoutOrders

 /**
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public static function withoutOrders()
 {
     $instance = new static();
     $query = $instance->newQuery();
     $query->getQuery()->orders = [];
     return $query;
 }
开发者ID:GlobalsDD,项目名称:admin,代码行数:10,代码来源:SleepingOwlModel.php

示例2: sync

 public static function sync($fromDate = '')
 {
     $instance = new static();
     $newQuery = static::syncFilter($instance->newQuery()->where(function ($query) use(&$fromDate) {
         $query->where('created_at', '>', $fromDate)->orWhereNull('created_at');
     }));
     $updateQuery = static::syncFilter($instance->newQuery()->where('updated_at', '>', $fromDate)->where('created_at', '<', $fromDate));
     $deleteQuery = static::syncFilter($instance->newQuery()->onlyTrashed()->where('deleted_at', '>', $fromDate));
     if ($fromDate == '') {
         return array('new' => $newQuery->get()->toArray(), 'updated' => null, 'deleted' => null);
     }
     return array('new' => $newQuery->get()->toArray(), 'updated' => $updateQuery->get()->toArray(), 'deleted' => $deleteQuery->get()->toArray());
 }
开发者ID:badchoice,项目名称:grog,代码行数:13,代码来源:SyncTrait.php

示例3: findBySlug

 public static function findBySlug($slug, $columns = ['*'])
 {
     $instance = new static();
     if (is_array($slug)) {
         return $instance->newQuery()->whereIn('slug', $slug)->get($columns);
     }
     return $instance->newQuery()->slug($slug)->get($columns);
 }
开发者ID:konversation,项目名称:cuckoo,代码行数:8,代码来源:SlugTrait.php

示例4: find

 public static function find($id, $columns = array('*'))
 {
     if (is_array($id) && empty($id)) {
         return new Collection();
     }
     $instance = new static();
     $obj = $instance->newQuery()->find($id, $columns);
     if (is_array($id)) {
         $prop = new ReflectionProperty(get_class($obj), 'items');
     }
     $col = array();
     if (isset($prop->name)) {
         $prop->setAccessible(1);
         foreach ($prop->getValue($obj) as $k => $object) {
             $translation = Translations::find($object->table . "_" . $object->id . "_" . strtolower(Config::get('cms.currlang.code')));
             $object->setRawAttributes(json_decode($translation->translation, 1));
             $col[] = $object;
         }
         $prop->setValue($obj, $col);
     } else {
         $translation = Translations::find($obj->table . "_" . $obj->id . "_" . strtolower(Config::get('cms.currlang.code')));
         $obj->setRawAttributes(json_decode($translation->translation, 1));
         $seo = $obj->seo()->first();
         if (!is_null($seo)) {
             Config::set('cms.seo', $seo);
         }
     }
     //
     return $obj;
 }
开发者ID:basdog22,项目名称:laracms,代码行数:30,代码来源:Lara.php

示例5: findBy

 /**
  * Find a model by its primary key.
  * @param  string  $name
  * @param  mixed  $key
  * @param  array  $columns
  * @return \Illuminate\Support\Collection|static|null
  */
 public static function findBy($name, $key, $columns = array('*'))
 {
     $instance = new static();
     if (is_array($key) && empty($key)) {
         return $instance->newCollection();
     }
     return $instance->newQuery()->where($name, '=', $key)->get();
 }
开发者ID:jbs321,项目名称:affiliate-reporting-v1,代码行数:15,代码来源:AbstractModel.php

示例6: __callStatic

 /**
  * {@inheritDoc}
  */
 public static function __callStatic($method, $parameters)
 {
     $instance = new static();
     if (in_array($method, array_keys($instance->paths))) {
         return $instance->newQuery()->from($instance->getPath($method));
     }
     return call_user_func_array(array($instance, $method), $parameters);
 }
开发者ID:ghermans,项目名称:openprovider-client,代码行数:11,代码来源:BaseModel.php

示例7: with

 public static function with($relations)
 {
     if (is_string($relations)) {
         $relations = func_get_args();
     }
     $instance = new static();
     return $instance->newQuery()->with($relations);
 }
开发者ID:noherczeg,项目名称:restext,代码行数:8,代码来源:ResourceEloquentEntity.php

示例8: all

 /**
  * Get all of the models from the database. Overrides the base behavior to
  * add the category slug as a condition.
  *
  * @param array $columns
  *   An array of columns to access.
  *
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public static function all($columns = ['*'])
 {
     // If there's a defined taxonomy slug, attach that.
     $instance = new static();
     if (isset($instance->taxonomy_slug) && $instance->taxonomy_slug) {
         // Return a constrained collection.
         $columns = is_array($columns) ? $columns : func_get_args();
         return $instance->newQuery()->where('taxonomy', $instance->taxonomy_slug)->get($columns);
     }
     // Return the parent's behavior, if nothing is set.
     return parent::all($columns);
 }
开发者ID:ithinkdancan,项目名称:framework,代码行数:21,代码来源:TaxonomyTermModel.php

示例9: where

 /**
  * Add a basic where clause to the client query.
  * Normally, Illuminate\Database\Eloquent\Model handles this method (through __call()).
  * This implementation converts foreign ids from strings to MongoIds.
  *
  * @param  string  $column
  * @param  string  $operator
  * @param  mixed   $value
  * @param  string  $boolean
  * @return Jenssegers\Mongodb\Eloquent\Builder
  */
 public static function where($column, $operator = null, $value = null, $boolean = 'and')
 {
     if (func_num_args() == 2) {
         list($value, $operator) = array($operator, '=');
     }
     if ($column == 'lrs_id') {
         $value = new \MongoId($value);
     }
     $instance = new static();
     $query = $instance->newQuery();
     return $query->where($column, $operator, $value, $boolean);
 }
开发者ID:scmc,项目名称:learninglocker,代码行数:23,代码来源:Client.php

示例10: find

 /**
  * Find a model by its primary key.
  *
  * @param  mixed                                          $id
  * @param  array                                          $columns
  * @return \Illuminate\Database\Eloquent\Model|Collection
  */
 public static function find($id, $columns = array('*'))
 {
     $instance = new static();
     if (is_array($id) && empty($id)) {
         return $instance->newCollection();
     }
     $query = $instance->newQuery();
     $key = $instance->table . '.' . $instance->primaryKey;
     if (is_array($id)) {
         return $query->whereIn($key, $id)->get($columns);
     }
     return $query->where($key, '=', $id)->first($columns);
 }
开发者ID:khaliqgant,项目名称:Deep,代码行数:20,代码来源:JoinableTrait.php

示例11: createFromXml

 /**
  *
  * Method designed to save XML data into a table
  *
  * @param SimpleXMLElement $fieldData
  *
  * @return \Illuminate\Support\Collection
  */
 public static function createFromXml(\SimpleXMLElement $fieldData)
 {
     $instance = new static();
     if (!is_null($fieldData->attributes())) {
         foreach ($fieldData->attributes() as $k => $v) {
             if ($k == 'Resource') {
                 $instance->resource = $v;
             }
             if ($k == 'Lookup') {
                 $instance->lookup_id = $v;
             }
         }
     }
     $lookup = (array) $fieldData->xpath('Lookup');
     foreach ($lookup as $field) {
         $instance->exists = false;
         $field = (array) $field;
         $instance->id = $field['Value'];
         $instance->long = $field['LongValue'];
         $instance->short = $field['ShortValue'];
         $instance->save();
     }
     return $instance->newQuery()->where('lookup_id', $instance->lookup_id)->where('resource', $instance->resource)->get();
 }
开发者ID:mikhailkozlov,项目名称:rets-laravel,代码行数:32,代码来源:RetsField.php

示例12: allTrunks

 /**
  * Static query scope. Returns a query scope with all nodes which are at
  * the middle of a branch (not root and not leaves).
  *
  * @return \Illuminate\Database\Query\Builder
  */
 public static function allTrunks()
 {
     $instance = new static();
     $grammar = $instance->getConnection()->getQueryGrammar();
     $rgtCol = $grammar->wrap($instance->getQualifiedRightColumnName());
     $lftCol = $grammar->wrap($instance->getQualifiedLeftColumnName());
     return $instance->newQuery()->whereNotNull($instance->getParentColumnName())->whereRaw($rgtCol . ' - ' . $lftCol . ' != 1')->orderBy($instance->getQualifiedOrderColumnName());
 }
开发者ID:lostcause,项目名称:baum,代码行数:14,代码来源:Node.php

示例13: fixTree

 /**
  * Fixes the tree based on parentage info.
  *
  * Requires at least one root node. This will not update nodes with invalid parent.
  *
  * @return int The number of fixed nodes.
  */
 public static function fixTree()
 {
     $model = new static();
     $columns = [$model->getKeyName(), $model->getParentIdName(), $model->getLftName(), $model->getRgtName()];
     $nodes = $model->newQuery()->defaultOrder()->get($columns)->groupBy($model->getParentIdName());
     self::reorderNodes($nodes, $fixed);
     return $fixed;
 }
开发者ID:kjmtrue,项目名称:laravel-nestedset,代码行数:15,代码来源:Node.php

示例14: startQuery

 /**
  * Kick off a new query.
  *
  * @return	Builder
  */
 public static function startQuery()
 {
     // Get a new instance of the model
     $instance = new static();
     return $instance->newQuery();
 }
开发者ID:kleitz,项目名称:bjga-scheduler,代码行数:11,代码来源:Model.php

示例15: byUuid

 /**
  * @param string $uuid
  *
  * @return Card
  */
 public static function byUuid($uuid)
 {
     $instance = new static();
     $query = $instance->newQuery();
     return $query->where('uuid', $uuid)->firstOrFail();
 }
开发者ID:rupertjeff,项目名称:ascension-card-db,代码行数:11,代码来源:Model.php


注:本文中的static::newQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。