addConstraints() public method

Set the base constraints on the relation query.
public addConstraints ( ) : void
return void
Example #1
0
 /**
  * Set the base constraints on the relation query.
  */
 public function addConstraints()
 {
     if (static::$constraints) {
         $key = $this->query->getQuery()->getGrammar()->wrap($this->related->getTable() . '.' . $this->langKey);
         $this->query->getQuery()->orderByRaw('FIELD(' . $key . ', ?, ?) DESC', [$this->fallback, $this->lang]);
     }
     parent::addConstraints();
 }