__construct() public method

Create a new belongs to relationship instance.
public __construct ( Builder $query, Model $parent, string $foreignKey, string $otherKey, string $relation ) : void
$query Illuminate\Database\Eloquent\Builder
$parent Illuminate\Database\Eloquent\Model
$foreignKey string
$otherKey string
$relation string
return void
Beispiel #1
3
 public function __construct(Builder $query, Model $parent, $foreignKey, $otherKey, $relationName)
 {
     $this->relationName = $relationName;
     parent::__construct($query, $parent, $foreignKey, $otherKey, $relationName);
 }
 /**
  * BelongToLang constructor.
  *
  * @param Builder  $query
  * @param Eloquent $parent
  * @param string   $foreignKey
  * @param string   $otherKey
  * @param string   $langKey
  * @param string   $relation
  * @param null     $lang
  * @param null     $fallback
  */
 public function __construct(Builder $query, Eloquent $parent, $foreignKey, $otherKey, $langKey, $relation, $lang = null, $fallback = null)
 {
     $this->lang = $lang ?: Lang::getLocale();
     $this->fallback = $fallback ?: Lang::getFallback();
     $this->langKey = $langKey ?: 'lang';
     $this->fallbackQuery = clone $query;
     parent::__construct($query, $parent, $foreignKey, $otherKey, $relation);
 }
Beispiel #3
0
 /**
  * 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  $type
  * @param  string  $relation
  * @return void
  */
 public function __construct(Builder $query, Model $parent, $foreignKey, $otherKey, $type, $relation)
 {
     $this->morphType = $type;
     parent::__construct($query, $parent, $foreignKey, $otherKey, $relation);
 }