当我制作种子 Laravel 时没有足够的参数缺少名称
Not enough arguments missing name when i make seed 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'
]);
}
}
这是DB对应的迁移table...
class CreateProfessionsTable extends Migration
{
public function up()
{
Schema::create('professions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('title', 100);
$table->timestamps();
});
}
知道发生了什么事吗?
谢谢!
您可以使用 artisan help
:
查看命令的要求
php artisan help make:seed
将输出如下内容:
Description:
Create a new seeder class
Usage:
make:seeder <name>
Arguments:
name The name of the class
...
此命令接受您要创建的 class 名称的参数。
php artisan make:seed ProfessionSeeder
我正在尝试制作种子:
php artisan make:seed
但是,我收到错误:
Not enough arguments (missing: "name").
我不知道为什么,这是我要制作的种子:
class ProfessionSeeder extends Seeder
{
public function run()
{
DB::table('professions')->insert([
'title' => 'Desarrollador Back End'
]);
}
}
这是DB对应的迁移table...
class CreateProfessionsTable extends Migration
{
public function up()
{
Schema::create('professions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('title', 100);
$table->timestamps();
});
}
知道发生了什么事吗?
谢谢!
您可以使用 artisan help
:
php artisan help make:seed
将输出如下内容:
Description:
Create a new seeder class
Usage:
make:seeder <name>
Arguments:
name The name of the class
...
此命令接受您要创建的 class 名称的参数。
php artisan make:seed ProfessionSeeder