Search code examples
phplaravellaravel-migrationslaravel-seeding

Syntax error, unexpected ',' when trying to seed in Laravel 5.6 using cmd


I'm trying to follow a tutorial on using command prompt in Windows. It's called Laravel Tutorial: Step by Step Guide to Building Your First Laravel Application and I'm stuck in seed :

use Illuminate\Database\Seeder;

class TestingTableSeeder extends Seeder
{
  public function run()
  {
    factory:(App\Testing::class, 5)->create();
  }
}

I already tried solutions from other question on Stack Overflow but I'm unable to fix the error.


Solution

  • It should be:

    factory(App\Testing::class, 5)->create();
    

    instead of

    factory:(App\Testing::class, 5)->create();