ichtrojan/laravel-location

Laravel 8: Table Seeder

sahamilton opened this issue · 4 comments

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.

As a workaround add the below to your composer.json

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

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

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

Run

composer dump-autoload