Laravel 9 - 错误 Class BooksSeeder 不存在

Laravel 9 - Error Class BooksSeeder does not exist

当我 运行 php artisan make:seeder --class=BooksSeeder 我收到以下错误:

The "--class" option does not exist.

谁能帮帮我? 我还是新手 Laravel

我的 DatabaseSeeder Class:

<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // \App\Models\User::factory(10)->create();
    }
}

我的 BooksSeeder Class:

<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Books;


class BooksSeeder extends Seeder
{
    public function run()
    {
        $faker = \Faker\Factory::create();
        for ($i = 0; $i < 50; $i++) {
            Books::create([
                'name' => $faker->sentence,
                'author' => $faker->name,
                'publish_date' => $faker->date,
            ]);
        }
    }
}

您使用了错误的语法。

要创建播种器,请使用:

php artisan make:seeder BooksSeeder

到运行播种机,使用:

php artisan db:seed --class=BooksSeeder