protected function setModel()
    {
        if (count($this->models) > 1) {
            $this->info('You need to select which model you want to update');
            foreach ($this->models as $key => $value) {
                $this->info("[$key] $value");
            }
            $askModel = $this->ask('Which model would you like to use?', array_keys($this->models)[0]);

            if (!array_key_exists($askModel, $this->models)) {
                throw new InvalidModelException('The input you gave is not valid');
            }

            $this->model = new $this->models[$askModel];
        } else {
            $this->model = new $this->models[array_keys($this->models)[0]];
        }
    }
protected function setModel()
    {
        if (count($this->models) > 1) {
            $this->info('You need to select which model you want to update');
            foreach ($this->models as $key => $value) {
                $this->info("[$key] $value");
            }
            $askModel = $this->ask('Which model would you like to use?', array_keys($this->models)[0]);

            if (!array_key_exists($askModel, $this->models)) {
                throw new InvalidModelException('The input you gave is not valid');
            }

            $this->model = new $this->models[$askModel];
        } else {
            $this->model = new $this->models[array_keys($this->models)[0]];
        }
    }
protected function setModel ( ) { if ( count ( $ this -> models ) > 1 ) { $ this -> info ( 'You need to select which model you want to update' ) ; foreach ( $ this -> models as $ key => $ value ) { $ this -> info ( "[$key] $value" ) ; } $ askModel = $ this -> ask ( 'Which model would you like to use?' , array_keys ( $ this -> models ) [ 0 ] ) ; if ( ! array_key_exists ( $ askModel , $ this -> models ) ) { throw new InvalidModelException ( 'The input you gave is not valid' ) ; } $ this -> model = new $ this -> models [ $ askModel ] ; } else { $ this -> model = new $ this -> models [ array_keys ( $ this -> models ) [ 0 ] ] ; } }
Set the model

@throws InvalidModelException
Set the model