我制作种子Laravel

我正试图用:

php artisan make:seed

但是,我得到了错误:

Not enough arguments (missing: "name").

我不知道为什么,这是我要制造的种子:

class ProfessionSeeder extends Seeder
{

    public function run()
    {
        DB::table('professions')->insert([
            'title' => 'Desarrollador Back End'
        ]);
    }
}

这是与数据库表相对应的迁移...

class CreateProfessionsTable extends Migration
{
    public function up()
    {
        Schema::create('professions',function (Blueprint $table) {
            $table->bigIncrements('id');

            $table->string('title',100);


            $table->timestamps();
        });
    }

有什么想法吗?

谢谢!

maduso 回答:我制作种子Laravel

您可以使用artisan help查看命令的要求:

php artisan help make:seed

将输出类似:

Description:
  Create a new seeder class

Usage:
  make:seeder <name>

Arguments:
  name                  The name of the class
...

此命令接受您要创建的类的名称的参数。

php artisan make:seed ProfessionSeeder
本文链接:https://www.f2er.com/3148481.html

大家都在问