/** * Get a new query builder for the model's table. * Overriden from {@link \Model\Eloquent} to allow for usage of {@link throwOnFind}. * * @param bool $excludeDeleted * @return \Illuminate\Database\Eloquent\Builder */ public function newQuery($excludeDeleted = true) { $builder = new Builder($this->newBaseQueryBuilder()); $builder->throwOnFind = static::$throwOnFind; // 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); foreach ($this->getGlobalScopes() as $identifier => $scope) { $builder->withGlobalScope($identifier, $scope); } return $builder; }
/** * Get a new query builder for the model's table. * Overriden from {@link \Model\Eloquent} to allow for usage of {@link throwOnFind} in our {@link Builder}. * * @see Model::newQueryWithoutScopes() * @return \Illuminate\Database\Eloquent\Builder */ public function newQueryWithoutScopes() { $builder = new Builder($this->newBaseQueryBuilder()); $builder->throwOnFind = static::$throwOnFind; return $builder->setModel($this)->with($this->with); }