Esempio n. 1
0
 /**
  * @param bool $overwrite_existing
  * @return Builder
  * @throws BadDataQueryException
  */
 public function makeModel($overwrite_existing = false)
 {
     if ($overwrite_existing || $this->model === null) {
         $this->modelInstance = $this->app->make($this->model());
         if (!$this->modelInstance instanceof Model) {
             $message = 'Class `%s` must be an instance of `%s`';
             $message = sprintf($message, $this->model(), Model::class);
             throw new BadDataQueryException($this, $message);
         }
         if ($this->modelInstance instanceof ISluggable) {
             $this->isSluggable = true;
         }
         $this->model = $this->modelInstance->newQuery();
     }
     return $this->model;
 }