Following instructions from the official page in the Advanced part when I run php artisan db:seed --class=VoyagerDatabaseSeeder I am getting an error (see below).
Steps to reproduce the behavior:
php artisan voyager:installphp artisan vendor:publish --provider="TCG\Voyager\VoyagerServiceProvider" AND php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5" AND php artisan migrate AND perform tha changes in USER class and route.php artisan db:seed --class=VoyagerDatabaseSeeder I get the follow error:```
ReflectionException : Class VoyagerDatabaseSeeder does not exist
at /home/ila/vhosts/voyager2/vendor/laravel/framework/src/Illuminate/Container/Container.php:788
784| if ($concrete instanceof Closure) {
785| return $concrete($this, $this->getLastParameterOverride());
786| }
787|
788| $reflector = new ReflectionClass($concrete);
789|
790| // If the type is not instantiable, the developer is attempting to resolve
791| // an abstract type such as an Interface or Abstract Class and there is
792| // no binding registered for the abstractions so we need to bail out.
Exception trace:
1 ReflectionClass::__construct("VoyagerDatabaseSeeder")
/home/ila/vhosts/voyager2/vendor/laravel/framework/src/Illuminate/Container/Container.php:788
2 Illuminate\Container\Container::build("VoyagerDatabaseSeeder")
/home/ila/vhosts/voyager2/vendor/laravel/framework/src/Illuminate/Container/Container.php:667
Please use the argument -v to see more details.
## Expected behavior
No error. Should have the database initialized with some basic data
## Note:
If then I run `php artisan voyager:install --with-dummy` everything works good, even the command that was generating the error. Here you have the output:
php artisan voyager:install --with-dummy
Publishing the Voyager assets, database, and config files
Copied Directory [/vendor/tcg/voyager/publishable/database/seeds] To [/database/seeds]
Publishing complete.
Publishing complete.
Migrating the database tables into your application
Nothing to migrate.
Attempting to set Voyager User model as parent to App\User
Dumping the autoloaded files and reloading all new files
Adding Voyager routes to routes/web.php
Seeding data into the database
Publishing dummy content
Copied Directory [/vendor/tcg/voyager/publishable/database/dummy_seeds] To [/database/seeds]
Copied Directory [/vendor/tcg/voyager/publishable/dummy_content] To [/storage/app/public]
Copied Directory [/vendor/tcg/voyager/publishable/database/migrations] To [/database/migrations]
Publishing complete.
Migrating dummy tables
Migrating: 2016_01_01_000000_create_pages_table
Migrated: 2016_01_01_000000_create_pages_table (0.58 seconds)
Migrating: 2016_01_01_000000_create_posts_table
Migrated: 2016_01_01_000000_create_posts_table (0.44 seconds)
Migrating: 2016_02_15_204651_create_categories_table
Migrated: 2016_02_15_204651_create_categories_table (1.37 seconds)
Migrating: 2017_04_11_000000_alter_post_nullable_fields_table
Migrated: 2017_04_11_000000_alter_post_nullable_fields_table (0.62 seconds)
Seeding dummy data
Setting up the hooks
Copied File [/vendor/larapack/hooks/publishable/config/hooks.php] To [/config/hooks.php]
Publishing complete.
Hooks are now ready to use! Go ahead and try to "php artisan hook:install test-hook"
Adding the storage symlink to your public folder
The [public/storage] directory has been linked.
Successfully installed Voyager! Enjoy
ila@ila:~/vhosts/voyager2(master)$ php artisan db:seed --class=VoyagerDatabaseSeeder
Database seeding completed successfully.
```
You either run php artisan voyager:install or do the advanced steps. Not both.
I resolved this by modifying my DatabaseSeeder to include the content of the VoyagerDatabaseSeeder. Specifically:
use TCG\Voyager\Traits\Seedable;
right bellow class definition:
use Seedable;
protected $seedersPath = __DIR__.'/';
inside the run method:
$this->seed('DataTypesTableSeeder');
$this->seed('DataRowsTableSeeder');
$this->seed('MenusTableSeeder');
$this->seed('MenuItemsTableSeeder');
$this->seed('RolesTableSeeder');
$this->seed('PermissionsTableSeeder');
$this->seed('PermissionRoleTableSeeder');
$this->seed('SettingsTableSeeder');
Not sure why, but I did the installation manually as I had an already existing application.
Hi, just FYI: I had the same problem and in my case I just had to do a composer dump-autoload before running the seeder.
if you change locale in config/app.php
Return it to
'locale' => 'en',
then
composer dump-autoload
php artisan voyager:install
i still get this error on laravel8.
i installed voyager using 'php artisan voyager:install --with-dummy'
now i need to run only voyager seeder but i get 'Class VoyagerDatabaseSeeder does not exist.'
'composer dump-autoload ' don't solve this problem :(
note: i have 'database/seeds' folder which contain all voyager seeders
i still get this error on laravel8.
i installed voyager using 'php artisan voyager:install --with-dummy'
now i need to run only voyager seeder but i get 'Class VoyagerDatabaseSeeder does not exist.'
'composer dump-autoload ' don't solve this problem :(
note: i have 'database/seeds' folder which contain all voyager seeders
namespace Database\Seeders;use Seedable; and change run method)
Most helpful comment
Hi, just FYI: I had the same problem and in my case I just had to do a
composer dump-autoloadbefore running the seeder.