Did you edit the migration stub?
Feb 28, 2024
7
Level 8
Migration laravel
Hi!
When i try to create new migration file in Laravel:
php artisan make:migration create_typeoftracker_table
I get this error message ?
syntax error, unexpected token "{", expecting identifier
at database/migrations/2024_02_28_075305_create_typeoftracker.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class {{ class }} extends Migration
8▕ {
9▕ /**
10▕ * Run the migrations.
11▕ *
+17 vendor frames
18 artisan:35
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Level 104
@birdietorerik you are using Laravel 10 on this project right? However, this is a stub from earlier an Laravel version (now migrations use anonymous classes), so I suppose you published the stubs before upgrading?
Can you delete the stubs/migration.create.stub file and try again?
If you want a quick fix just for this file, you can change the migration file like this:
// class {{ class }} extends Migration
return new class extends Migration
Please or to participate in this conversation.