0

I am trying to use seeder following a tutorial but I am always getting this error

Illuminate\Contracts\Container\BindingResolutionException

Target class [HotelSeeder] does not exist.

when I run this command :

php artisan db:seed

I have in database\seeders\DatabaseSeeder.php add this line

$this->call(\HotelSeeder::class);

into the up function

and in database\seeders\HotelSeeder.php

<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class HotelSeeder extends Seeder
{

**I am using latest version laravel 8 and phpstorm **

I have tried lot of solutions like composer dump-autoload and adding namespace to the seeder function but none of them has worked. Thanks in advance

1 Answers1

1

Well I have found the solution: I have launched

composer dumpautoload

then I have gone to package.json and added this line

"classmap": [
            "database"
        ],

Before :

},
    "autoload": {
        "psr-4": {

After

    },
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {

and I have rerun

composer dumpautoload

and It works !