samedi 14 octobre 2017

Class ArticlesTableSeeder does not exist, but ArticlesTableSeeder exists

I have created a project using Laravel 5.4 and Homestead. I created a seed using php artisan make:seeder ArticlesTableSeeder, which results in a 'seeder created successfully' message. The seeder is in database/seeds/ArticlesTableSeeder.php and looks like this:

<?php

use Illuminate\Database\Seeder;

class ArticlesTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Article::truncate();

        $faker = \Faker\Factory::create();

        for($i = 0; $i < 50; $i++) {
            Article::create([
                'title' => $faker->sentence,
                'body' => $faker->paragraph,
            ]);
        }
    }
}

However, when I run php artisan db:seed --class=ArticlesTableSeeder I get this error:

[ReflectionException]                     
Class ArticlesTableSeeder does not exist

What's going on here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire