Skip to content

Commit

Permalink
fixed older laravel version incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
iberflow committed Mar 11, 2017
1 parent 9b09663 commit cae70ba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Commands/MakeModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,15 @@ protected function generateTable($table)

// replace table prefix
$tablePrefix = $this->option('prefix') ?: \DB::getTablePrefix();
$prefixRemovedTableName = str_replace($tablePrefix,'',$table);
$prefixRemovedTableName = str_replace($tablePrefix, '', $table);

$class = VariableConversion::convertTableNameToClassName($prefixRemovedTableName);

$name = Pluralizer::singular($this->qualifyClass($prefix . $class));

if (method_exists($this, 'qualifyClass')) {
$name = Pluralizer::singular($this->qualifyClass($prefix . $class));
} else {
$name = Pluralizer::singular($this->parseName($prefix . $class));
}

if ($this->files->exists($path = $this->getPath($name)) && !$this->option('force')) {
return $this->error($this->extends . ' for ' . $table . ' already exists!');
Expand Down Expand Up @@ -413,7 +417,7 @@ protected function getOptions()
{
return [
['tables', null, InputOption::VALUE_OPTIONAL, 'Comma separated table names to generate', null],
['prefix',null, InputOption::VALUE_OPTIONAL, 'Table prefix',null],
['prefix', null, InputOption::VALUE_OPTIONAL, 'Table prefix', null],
['dir', null, InputOption::VALUE_OPTIONAL, 'Model directory', $this->namespace],
['extends', null, InputOption::VALUE_OPTIONAL, 'Parent class', $this->extends],
['fillable', null, InputOption::VALUE_OPTIONAL, 'Rules for $fillable array columns', $this->fillableRules],
Expand Down

0 comments on commit cae70ba

Please sign in to comment.