diff --git a/src/Generators/MigrationGenerator.php b/src/Generators/MigrationGenerator.php index a3a8dfc7..d2c307db 100644 --- a/src/Generators/MigrationGenerator.php +++ b/src/Generators/MigrationGenerator.php @@ -165,7 +165,7 @@ protected function buildDefinition(Model $model) } $column_definition = self::INDENT; - if ($dataType === 'bigIncrements' && $this->isLaravel7orNewer()) { + if ($dataType === 'bigIncrements') { $column_definition .= '$table->id('; } elseif ($dataType === 'rememberToken') { $column_definition .= '$table->rememberToken('; @@ -198,7 +198,7 @@ protected function buildDefinition(Model $model) $column->modifiers() ); - if ($column->dataType() === 'id' && $this->isLaravel7orNewer()) { + if ($column->dataType() === 'id') { $column_definition = $foreign; $foreign = ''; } @@ -210,7 +210,7 @@ function ($modifier) use ($column) { || (is_array($modifier) && key($modifier) === 'onDelete') || (is_array($modifier) && key($modifier) === 'onUpdate') || $modifier === 'foreign' - || ($modifier === 'nullable' && $this->isLaravel7orNewer() && $column->dataType() === 'id'); + || ($modifier === 'nullable' && $column->dataType() === 'id'); } ); } @@ -277,14 +277,10 @@ protected function buildPivotTableDefinition(array $segments) $on = Str::plural($column); $foreign = Str::singular($column) . '_' . $references; - if (! $this->isLaravel7orNewer()) { - $definition .= self::INDENT . '$table->unsignedBigInteger(\'' . $foreign . '\');' . PHP_EOL; - } - if (config('blueprint.use_constraints')) { $this->hasForeignKeyConstraints = true; $definition .= $this->buildForeignKey($foreign, $on, 'id') . ';' . PHP_EOL; - } elseif ($this->isLaravel7orNewer()) { + } else { $definition .= self::INDENT . '$table->foreignId(\'' . $foreign . '\');' . PHP_EOL; } } @@ -322,7 +318,7 @@ protected function buildForeignKey(string $column_name, ?string $on, string $typ $on_update_suffix = self::ON_UPDATE_CLAUSES[$on_update_clause]; } - if ($this->isLaravel7orNewer() && $type === 'id') { + if ($type === 'id') { $prefix = in_array('nullable', $modifiers) ? '$table->foreignId' . "('{$column_name}')->nullable()" : '$table->foreignId' . "('{$column_name}')"; @@ -401,11 +397,6 @@ function (SplFileInfo $file) { return $dir . $timestamp->format('Y_m_d_His') . $name; } - protected function isLaravel7orNewer() - { - return version_compare(App::version(), '7.0.0', '>='); - } - protected function getPivotClassName(array $segments) { return 'Create' . Str::studly($this->getPivotTableName($segments)) . 'Table';