Illuminate\Database\Eloquent\Builder::setModel PHP Метод

setModel() публичный Метод

Set a model instance for the model being queried.
public setModel ( Model $model )
$model Model
    public function setModel(Model $model)
    {
        $this->model = $model;
        $this->query->from($model->getTable());
        return $this;
    }

Usage Example

 /**
  * Get a new query builder for the model's table.
  *
  * @return \Illuminate\Database\Eloquent\Builder;
  */
 public function newRawQuery()
 {
     $builder = new Builder($this->newBaseQueryBuilder());
     // Once we have the query builders, we will set the model instances
     // so the builder can easily access any information it may need
     // from the model while it is constructing and executing various
     // queries against it.
     $builder->setModel($this)->with($this->with);
     return $builder;
 }
All Usage Examples Of Illuminate\Database\Eloquent\Builder::setModel