Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

birdietorerik's avatar

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))

0 likes
7 replies
Snapey's avatar

Did you edit the migration stub?

tykus's avatar

@horlatech looks like the substitutions in the migration stub did not populate correctly. How did you generate the migration?

tykus's avatar
tykus
Best Answer
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
birdietorerik's avatar

@tykus Hi! deleted migration.create.stub, but same result ? How does this migration.create.stub locks like in laravel 10 ?

birdietorerik's avatar

@tykus Hi! Have modified my earlier versjon of laravel. -> migration.create.stub So i removed stubs from my application, and tryed again Now its working fine, thanks for Big help :)

Please or to participate in this conversation.