ichtrojan / laravel-location

A simple Laravel Package to sort Countries, States and Cities
MIT License
205 stars 44 forks source link

Laravel 8: Table Seeder #36

Closed sahamilton closed 3 years ago

sahamilton commented 3 years ago

Using a clean install of Laravel 8 when running composer dump-autoload Deprecation Notice: Class Ichtrojan\Location\Seeds\StatesTableSeeder located in C:/laragon/www/mapminer4/vendor/ichtrojan/laravel-location/src\database\seeds\StatesTableSeeder.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/laragon/bin/composer/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201

So when the seeders are run the following error is received: Target class [Ichtrojan\\Location\\Seeds\\LocationDatabaseSeeder] does not exist.

gaborm74 commented 3 years ago

As a workaround add the below to your composer.json

    "autoload": {
<...>
        "psr-4": {
        <...>
        "Ichtrojan\\Location\\Seeds\\": "vendor/ichtrojan/laravel-location/src/database/seeds/"
        }
    },
solamichealolawale commented 3 years ago

I followed this fix for Laravel8, it fixed the error message but then I can't run the seeder php artisan db:seed --class=Ichtrojan\\Location\\Seeds\\LocationDatabaseSeeder it displayed this error message image

ekpono commented 3 years ago

I am having the same error @ichtrojan

STEPS TO REPRODUCE Laravel 8 PHP 7.4

  1. composer require ichtrojan/laravel-location

ERROR: Class Ichtrojan\Location\Seeds\LocationDatabaseSeeder does not exist

Screen Shot 2021-03-20 at 3 31 43 PM
ichtrojan commented 3 years ago

Run

composer dump-autoload