當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。