@@ -165,7 +165,7 @@ protected function buildDefinition(Model $model)
165
165
}
166
166
167
167
$ column_definition = self ::INDENT ;
168
- if ($ dataType === 'bigIncrements ' && $ this -> isLaravel7orNewer () ) {
168
+ if ($ dataType === 'bigIncrements ' ) {
169
169
$ column_definition .= '$table->id( ' ;
170
170
} elseif ($ dataType === 'rememberToken ' ) {
171
171
$ column_definition .= '$table->rememberToken( ' ;
@@ -198,7 +198,7 @@ protected function buildDefinition(Model $model)
198
198
$ column ->modifiers ()
199
199
);
200
200
201
- if ($ column ->dataType () === 'id ' && $ this -> isLaravel7orNewer () ) {
201
+ if ($ column ->dataType () === 'id ' ) {
202
202
$ column_definition = $ foreign ;
203
203
$ foreign = '' ;
204
204
}
@@ -210,7 +210,7 @@ function ($modifier) use ($column) {
210
210
|| (is_array ($ modifier ) && key ($ modifier ) === 'onDelete ' )
211
211
|| (is_array ($ modifier ) && key ($ modifier ) === 'onUpdate ' )
212
212
|| $ modifier === 'foreign '
213
- || ($ modifier === 'nullable ' && $ this -> isLaravel7orNewer () && $ column ->dataType () === 'id ' );
213
+ || ($ modifier === 'nullable ' && $ column ->dataType () === 'id ' );
214
214
}
215
215
);
216
216
}
@@ -277,14 +277,10 @@ protected function buildPivotTableDefinition(array $segments)
277
277
$ on = Str::plural ($ column );
278
278
$ foreign = Str::singular ($ column ) . '_ ' . $ references ;
279
279
280
- if (! $ this ->isLaravel7orNewer ()) {
281
- $ definition .= self ::INDENT . '$table->unsignedBigInteger( \'' . $ foreign . '\'); ' . PHP_EOL ;
282
- }
283
-
284
280
if (config ('blueprint.use_constraints ' )) {
285
281
$ this ->hasForeignKeyConstraints = true ;
286
282
$ definition .= $ this ->buildForeignKey ($ foreign , $ on , 'id ' ) . '; ' . PHP_EOL ;
287
- } elseif ( $ this -> isLaravel7orNewer ()) {
283
+ } else {
288
284
$ definition .= self ::INDENT . '$table->foreignId( \'' . $ foreign . '\'); ' . PHP_EOL ;
289
285
}
290
286
}
@@ -322,7 +318,7 @@ protected function buildForeignKey(string $column_name, ?string $on, string $typ
322
318
$ on_update_suffix = self ::ON_UPDATE_CLAUSES [$ on_update_clause ];
323
319
}
324
320
325
- if ($ this -> isLaravel7orNewer () && $ type === 'id ' ) {
321
+ if ($ type === 'id ' ) {
326
322
$ prefix = in_array ('nullable ' , $ modifiers )
327
323
? '$table->foreignId ' . "(' {$ column_name }')->nullable() "
328
324
: '$table->foreignId ' . "(' {$ column_name }') " ;
@@ -401,11 +397,6 @@ function (SplFileInfo $file) {
401
397
return $ dir . $ timestamp ->format ('Y_m_d_His ' ) . $ name ;
402
398
}
403
399
404
- protected function isLaravel7orNewer ()
405
- {
406
- return version_compare (App::version (), '7.0.0 ' , '>= ' );
407
- }
408
-
409
400
protected function getPivotClassName (array $ segments )
410
401
{
411
402
return 'Create ' . Str::studly ($ this ->getPivotTableName ($ segments )) . 'Table ' ;
0 commit comments