本文整理汇总了PHP中Illuminate\Database\Eloquent\Relations\Relation::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Relation::__construct方法的具体用法?PHP Relation::__construct怎么用?PHP Relation::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Relations\Relation
的用法示例。
在下文中一共展示了Relation::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a new belongs to relationship instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $foreignKey
* @param string $otherKey
* @param string $relation
* @return void
*/
public function __construct(Builder $query, Model $parent, $foreignKey, $otherKey, $relation)
{
$this->otherKey = $otherKey;
$this->relation = $relation;
$this->foreignKey = $foreignKey;
parent::__construct($query, $parent);
}
示例2: __construct
/**
* DescendantsRelation constructor.
*
* @param QueryBuilder $builder
* @param Model $model
*/
public function __construct(QueryBuilder $builder, Model $model)
{
if (!NestedSet::isNode($model)) {
throw new InvalidArgumentException('Model must be node.');
}
parent::__construct($builder, $model);
}
示例3: __construct
/**
* Create a new has many relationship instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $firstKey
* @param string $secondKey
* @return void
*/
public function __construct(Builder $query, Model $farParent, Model $parent, $firstKey, $secondKey)
{
$this->firstKey = $firstKey;
$this->secondKey = $secondKey;
$this->farParent = $farParent;
parent::__construct($query, $parent);
}
示例4: __construct
/**
* Create a new has many relationship instance.
*
* @param Illuminate\Database\Eloquent\Builder $query
* @param Illuminate\Database\Eloquent\Model $parent
* @param string $table
* @param string $foreignKey
* @param string $otherKey
* @return void
*/
public function __construct(Builder $query, Model $parent, $table, $foreignKey, $otherKey)
{
$this->table = $table;
$this->otherKey = $otherKey;
$this->foreignKey = $foreignKey;
parent::__construct($query, $parent);
}
示例5:
/**
* Create a new relation instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $farChild
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $firstKey
* @param string $localKey
*/
function __construct(Builder $query, Model $farChild, Model $parent, $firstKey, $localKey)
{
$this->farChild = $farChild;
$this->firstKey = $firstKey;
$this->localKey = $localKey;
parent::__construct($query, $parent);
}
示例6: __construct
/**
* Create a new instance of relation.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param array $models
* @param string|null $localKey
* @param string $prefix
* @param array $foreignKeyLookup
*/
public function __construct(Builder $query, Model $parent, array $models, $localKey = null, $prefix = '', $foreignKeyLookup = [])
{
$this->models = $models;
$this->localKey = $localKey ?: $parent->getKeyName();
$this->prefix = $prefix;
$this->foreignKeyLookup = $foreignKeyLookup;
parent::__construct($query, $parent);
}
示例7: __construct
public function __construct(Builder $query, Model $parent, string $relation, string $table)
{
parent::__construct($query, $parent);
$this->table = $table;
$this->relation = $relation;
$this->relationClass = $relation . '_type';
$this->relationKey = $relation . '_id';
}
示例8: __construct
public function __construct(Builder $builder, DatabaseNode $parent, Repository $repo)
{
parent::__construct($builder, $parent);
$this->repository = $repo;
$this->localKey = $parent->getIdName();
$this->foreignKey = $parent->getParentIdName();
$this->rootKey = $parent->getRootIdName();
}
示例9: __construct
/**
* Create a new has one or many relationship instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $foreignKey
* @param string $localKey
* @return void
*/
public function __construct(Builder $query, Model $parent, $foreignKey, $localKey)
{
$this->localKey = $localKey;
$this->foreignKey = $foreignKey;
parent::__construct($query, $parent);
}
示例10: __construct
/**
* Create a new instance of relation.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param array $models
* @param string|null $localKey
*/
public function __construct(Builder $query, Model $parent, array $models, $localKey = null)
{
$this->models = $models;
$this->localKey = $localKey ?: $parent->getKeyName();
parent::__construct($query, $parent);
}
示例11: __construct
public function __construct(Builder $builder, DatabaseSortable $parent, Repository $repo)
{
parent::__construct($builder, $parent, $repo);
}
示例12: __construct
/**
* Create a new has many relationship instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @return void
*/
public function __construct(Builder $query, Model $parent, $finder = 'get')
{
$this->finder = $finder;
parent::__construct($query, $parent);
}
示例13: __construct
public function __construct(Builder $query, Model $parent, Closure $matchSQL, Closure $matchPHP)
{
$this->matchSQL = $matchSQL;
$this->matchPHP = $matchPHP;
parent::__construct($query, $parent);
}
示例14: __construct
public function __construct(Builder $query, Model $parent, Closure $baseConstraints = null, Closure $eagerConstraints = null)
{
$this->baseConstraints($baseConstraints);
$this->eagerConstraints($eagerConstraints);
parent::__construct($query, $parent);
}
示例15: __construct
public function __construct(Model $parent)
{
parent::__construct($parent->newQuery(), $parent);
}