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


PHP Model::getQualifiedKeyName方法代码示例

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


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

示例1: findMany

 /**
  * Find a model by its primary key.
  *
  * @param  array  $id
  * @param  array  $columns
  * @return \Illuminate\Database\Eloquent\Model|Collection|static
  */
 public function findMany($id, $columns = array('*'))
 {
     if (empty($id)) {
         return $this->model->newCollection();
     }
     $this->query->whereIn($this->model->getQualifiedKeyName(), $id);
     return $this->get($columns);
 }
开发者ID:visualturk,项目名称:framework,代码行数:15,代码来源:Builder.php

示例2: checkQueryGroupBy

 protected function checkQueryGroupBy()
 {
     $groups = $this->query->getQuery()->groups;
     $keyGroup = $this->model->getQualifiedKeyName();
     if (empty($groups) || !in_array($keyGroup, $groups)) {
         $this->query->groupBy($keyGroup);
     }
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:8,代码来源:RelationshipQueryJoiner.php

示例3: whereKey

 /**
  * Add a where clause on the primary key to the query.
  *
  * @param  mixed  $id
  * @return $this
  */
 public function whereKey($id)
 {
     if (is_array($id)) {
         $this->query->whereIn($this->model->getQualifiedKeyName(), $id);
         return $this;
     }
     return $this->where($this->model->getQualifiedKeyName(), '=', $id);
 }
开发者ID:illuminate,项目名称:database,代码行数:14,代码来源:Builder.php

示例4: apply

 /**
  * Apply the scope to a given Eloquent query builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $builder
  * @param  \Illuminate\Database\Eloquent\Model  $model
  * @return void
  */
 public function apply(Builder $builder, Model $model)
 {
     $builder->join($model->getVersionTable(), function ($join) use($model) {
         $join->on($model->getQualifiedKeyName(), '=', $model->getQualifiedVersionKeyName());
         $join->on($model->getQualifiedVersionColumn(), '=', $model->getQualifiedLatestVersionColumn());
     });
     $this->extend($builder);
 }
开发者ID:Tapioca,项目名称:eloquent-versioning,代码行数:15,代码来源:VersioningScope.php

示例5: each

 /**
  * Execute a callback over each item while chunking.
  *
  * @param  callable  $callback
  * @param  int  $count
  * @return bool
  */
 public function each(callable $callback, $count = 1000)
 {
     if (is_null($this->query->orders) && is_null($this->query->unionOrders)) {
         $this->orderBy($this->model->getQualifiedKeyName(), 'asc');
     }
     return $this->chunk($count, function ($results) use($callback) {
         foreach ($results as $key => $value) {
             if ($callback($value, $key) === false) {
                 return false;
             }
         }
     });
 }
开发者ID:levanigongadze,项目名称:Labweb,代码行数:20,代码来源:Builder.php

示例6: generateJoinConstraints

 /**
  * @param JoinClause $query
  * @param array $constraints
  *
  * @throws \InvalidArgumentException
  */
 private function generateJoinConstraints($query, $constraints)
 {
     foreach ($constraints as $constraint) {
         if (empty($constraint)) {
             continue;
         } elseif (is_array($constraint)) {
             $constraint[2] = array_key_exists(2, $constraint) ? $constraint[2] : '=';
             $this->transformCustomConstraint($query, $constraint[0], $constraint[1], $constraint[2]);
         } elseif ($constraint instanceof Model) {
             $query->where($constraint->getQualifiedKeyName(), '=', $constraint->getKey());
         } elseif ($constraint instanceof Collection) {
             $query->whereIn($constraint->first()->getQualifiedKeyName(), $constraint->modelKeys());
         } elseif ($constraint instanceof \Closure) {
             call_user_func($constraint, $query);
         } elseif (is_int((int) $constraint)) {
             $query->where($this->related->getQualifiedKeyName(), '=', $constraint);
         } else {
             throw new \InvalidArgumentException('Join constraint is not an object.', 500);
         }
     }
 }
开发者ID:brazenvoid,项目名称:better-eloquent,代码行数:27,代码来源:JoinBuilder.php

示例7: getHasCompareKey

 /**
  * Get the key for comparing against the parent key in "has" query.
  *
  * @return string
  */
 public function getHasCompareKey()
 {
     return $this->farParent->getQualifiedKeyName();
 }
开发者ID:PrafullaKumarSahu,项目名称:wordpress-socializr,代码行数:9,代码来源:HasManyThrough.php

示例8: getQualifiedParentKeyName

 /**
  * Get the fully qualified parent key name.
  *
  * @return string
  */
 public function getQualifiedParentKeyName()
 {
     return $this->parent->getQualifiedKeyName();
 }
开发者ID:ProgrammingPeter,项目名称:nba-schedule-api,代码行数:9,代码来源:Relation.php

示例9: resolveQualifiedKeyName

 /**
  * Get the key name to use when querying for records.
  *
  * If no key name has been specified for the model, `Model::getQualifiedKeyName()` will be used as the
  * default.
  *
  * @param Model $model
  * @param $resourceType
  * @return string
  */
 protected function resolveQualifiedKeyName(Model $model, $resourceType)
 {
     return isset($this->keyNames[$resourceType]) ? sprintf('%s.%s', $model->getTable(), $this->keyNames[$resourceType]) : $model->getQualifiedKeyName();
 }
开发者ID:cloudcreativity,项目名称:laravel-json-api,代码行数:14,代码来源:EloquentAdapter.php

示例10: joinIntermediate

 /**
  * Join pivot or 'through' table.
  *
  * @param  \Illuminate\Database\Eloquent\Model $parent
  * @param  \Illuminate\Database\Eloquent\Relations\Relation $relation
  * @param  string $type
  * @return void
  */
 protected function joinIntermediate(Model $parent, Relation $relation, $type)
 {
     if ($relation instanceof BelongsToMany) {
         $table = $relation->getTable();
         $fk = $relation->getForeignKey();
     } else {
         $table = $relation->getParent()->getTable();
         $fk = $table . '.' . $parent->getForeignKey();
     }
     $pk = $parent->getQualifiedKeyName();
     if (!$this->alreadyJoined($join = (new Join($type, $table))->on($fk, '=', $pk))) {
         $this->query->joins[] = $join;
     }
 }
开发者ID:boukeversteegh,项目名称:eloquence,代码行数:22,代码来源:Joiner.php

示例11: getQualifiedParentKeyName

 /**
  * Get the fully qualified parent key naem.
  *
  * @return string
  */
 protected function getQualifiedParentKeyName()
 {
     return $this->parent->getQualifiedKeyName();
 }
开发者ID:gkmahendran09,项目名称:Eloquent-Outside-of-Laravel,代码行数:9,代码来源:Relation.php

示例12: enforceOrderBy

 /**
  * Add a generic "order by" clause if the query doesn't already have one.
  *
  * @return void
  */
 protected function enforceOrderBy()
 {
     if (empty($this->query->orders) && empty($this->query->unionOrders)) {
         $this->orderBy($this->model->getQualifiedKeyName(), 'asc');
     }
 }
开发者ID:bryanashley,项目名称:framework,代码行数:11,代码来源:Builder.php

示例13: getRelationCountQuery

 /**
  * Add the constraints for a relationship count query.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $query
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function getRelationCountQuery(Builder $query)
 {
     $query->select(new Expression('count(*)'));
     $key = $this->wrap($this->parent->getQualifiedKeyName());
     return $query->where($this->getForeignKey(), '=', new Expression($key));
 }
开发者ID:Thomvh,项目名称:turbine,代码行数:12,代码来源:Relation.php

示例14: getKeyName

 /**
  * {@inheritdoc}
  */
 protected function getKeyName()
 {
     return $this->model->getQualifiedKeyName();
 }
开发者ID:viniciusferreira,项目名称:laravel-repository,代码行数:7,代码来源:EloquentRepository.php


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