Closed mokhosh closed 3 years ago
Hi @mokhosh.
Since L8 does allow us to provide namespaces for the seeders, there is probably little reason to publish them. We can now just run the seeds directly from the package.
You could change the namespace to
Khsing\World\Database\Seeders
And change the init command to call the full class name
$this->call('db:seed',["--class"=>"Khsing\World\Database\Seeders\WorldTablesSeeder"]);
I was going to submit a pull request myself for that sort of change, but since you have already done something similar I though I would suggest it to you instead.
Unless you feel there is a reason the seeders should still be published to each project?
Good point.
I'd be happy either way. But still there is the problem in WorldTablesSeeder
where DB
is not imported, right?
I haven't tested it, but since DB is registered as an Alias in Laravel config/app I imagine it should just work without needing to import it. If not just calling it as\DB
should do the job.
I have solved the issue. There is a problem within the WorldServiceProvider, where the folders created in the database/ are not following the Laravel conventions. So just change the folder name from seeds to seeders from /database/seeds
to /database/seeders
solved the problem which is the default convention for laravel.
Please merge this PR.
+1
not working yet, is package updated for using composer by owner?
Illuminate\Contracts\Container\BindingResolutionException
Target class [Database\Seeders\WorldTablesSeeder] does not exist.
Just checked with a fresh Laravel 8 installation and seems to be working. Are you doing these steps in order?
composer require khsing/world
php artisan vendor:publish --force --provider="Khsing\World\WorldServiceProvider"
composer dump-autoload
php artisan world:init
@mokhosh Yes, i did all of commands as you pasted in comment, i get error again
@MahdiPishguy after composer dump-autoload
, you can check your autoloader files grep WorldTablesSeeder vendor/composer/*
, if no WorldTablesSeeder
, I think seeders files do not published.
I haven't checked if this package
init
s fine on previous versions, but it had some inconsistencies anyway. Here's what have been fixed:This fixes https://github.com/khsing/laravel-world/issues/39