Laravel-Backpack / Settings

Application settings interface for Backpack (for Laravel 6).
http://backpackforlaravel.com
Other
248 stars 78 forks source link

Ambiguous resolution of settings seeder #51

Closed gotrecillo closed 6 years ago

gotrecillo commented 7 years ago

After

php artisan vendor:publish --provider="Backpack\Settings\SettingsServiceProvider"

I am getting this error in composer.

Warning: Ambiguous class resolution, "Backpack\Settings\database\seeds\SettingsTableSeeder" was found in both "/home/gotre/Projects/backpackgenerator/demo/vendor/backpack/settings/src/database/seeds/SettingsTableSeeder.php" and "/home/gotre/Projects/backpackgenerator/demo/database/seeds/SettingsTableSeeder.php", the first will be used.

What about removing the namespace in the seeder published so there is no conflict ?

martinjoiner commented 6 years ago

I too got this error and deleted my unused app version of the seeder.

But when trying to understand it I have become confused as to how the SettingsTableSeeder.php in the package gets invoked.

SettingsServiceProvider.php (Lines 49-50) contains:

// publish the migrations and seeds
$this->publishes([__DIR__.'/database/migrations/' => database_path('migrations')], 'migrations');

Which explains how the migrations are discovered, but the seeds folder is a sibling of migrations and not explicitly referenced in the server provider.

I am using Laravel 5.6, is this possibly a bug caused by the auto-discovery feature added in 5.6?

tabacitu commented 6 years ago

Hi guys,

In the Settings installation, developers are not instructed to publish the seeds. Only to run them from the package. I personally think this is the way the installation should be, since the seeds aren't exactly necessary. They're just some demo entries, so you can get started. So no need to copy them in your project, so that they're run on staging/production.

Wouldn't you agree?

Thanks, cheers!

tabacitu commented 6 years ago

I'll close the issue for now. Reopen or reply if you think I'm wrong to do so. I make mistakes all the time.

Cheers!

martinjoiner commented 6 years ago

Just to clarify, I have not published the seeder in my application. The version in the composer library just gets discovered and run somehow! I do not know enough about Laravel 5.6 to know how it's managing to run. I am guessing from your response this is not intended behaviour.