Skip to content

Commit 1ec4328

Browse files
authored
Merge pull request #3 from coddin-web/feature/php-code-style-safe-migrations
Change migrations in our code format
2 parents 6760879 + 0663453 commit 1ec4328

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

stubs/migration.create.stub

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ return new class extends Migration
1010
{
1111
public function up(): void
1212
{
13-
Schema::create('{{ table }}', function (Blueprint $table) {
14-
$table->id();
15-
$table->timestamps();
16-
});
13+
Schema::create(
14+
'{{ table }}',
15+
function (Blueprint $table) {
16+
$table->id();
17+
$table->timestamps();
18+
},
19+
);
1720
}
1821

1922
public function down(): void

stubs/migration.update.stub

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ use Illuminate\Database\Migrations\Migration;
66
use Illuminate\Database\Schema\Blueprint;
77
use Illuminate\Support\Facades\Schema;
88

9-
final class {{ class }} extends Migration
9+
return new class extends Migration
1010
{
1111
public function up(): void
1212
{
13-
Schema::table('{{ table }}', function (Blueprint $table) {
14-
//
15-
});
13+
Schema::table(
14+
'{{ table }}',
15+
function (Blueprint $table) {
16+
//
17+
},
18+
);
1619
}
1720

1821
public function down(): void
1922
{
20-
Schema::table('{{ table }}', function (Blueprint $table) {
21-
//
22-
});
23+
Schema::table(
24+
'{{ table }}',
25+
function (Blueprint $table) {
26+
//
27+
},
28+
);
2329
}
24-
}
30+
};

0 commit comments

Comments
 (0)