jeudi 29 mars 2018

Laravel 5. Populating a DB. Error "Class does not exist" when execute "seed: db"

I get an error "Class does not exist" when trying to populate my DB by executing
"php artisan seed:db".

UserMoviesSeeder.php in the folder database/seeds has the following content:

<?php

use Illuminate\Database\Seeder;
use App\Project;
use App\UserMovie;
use App\User;

class UserMoviesSeeder extends Seeder
{
    public function run()
    {
      $this->call(ProjectsTableSeeder::class);
    }
}

class ProjectsTableSeeder extends Seeder {

   public function run()
   {
       DB::table('user_movies')->delete();
       DB::disableQueryLog();

       UserMovie::create([
           'user_id' => 1734805,
           'tmdb_id' => 100,
           'ratio' => 4
       ]);

       UserMovie::create([
           'user_id' => 716091,
           'tmdb_id' => 100,
           'ratio' => 4
       ]);
   }
}

I run the command:

php artisan db:seed --class=UserMoviesSeeder

And I get an error:

In Container.php line 752:
Class UserMoviesSeeder does not exist

Why?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire