尝试使用 cmd 在 Laravel 5.6 中播种时语法错误,意外的“,”

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

我正在尝试按照 Windows 中有关使用命令提示符的教程进行操作。它被称为 Laravel Tutorial: Step by Step Guide to Building Your First Laravel Application,我被困在种子中:

use Illuminate\Database\Seeder;

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

我已经尝试了 Stack Overflow 上其他问题的解决方案,但我无法修复错误。

应该是:

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

而不是

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

你调用的工厂函数是错误的,把后面的冒号(:)去掉:

use Illuminate\Database\Seeder;

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