hooks icon indicating copy to clipboard operation
hooks copied to clipboard

Name collision with Seed files

Open akazorg opened this issue 6 years ago • 3 comments

We cannot use Seed files using the same name of any of Voyager files, like DataRowsTableSeeder, PermissionsTableSeeder, etc., because they are being autoloaded from composer.

As result, when installing a Hook the system will use classes from the auloaded, missing the seeds located on the Hook folder.

This bug was hard to figure out, because install will run fine without any error message.

akazorg avatar Feb 06 '18 21:02 akazorg

We could namespace them, but that's not "standard" Laravel, and is hard to enforce in community-submitted hooks.

fletch3555 avatar Feb 07 '18 05:02 fletch3555

Yea, I think it would be a good idea to namespace them, but Laravel seeder does not support that by default, so will need to overwrite some code in the seeder script. Once that is done I think we should just write a best practice about doing so, in order for the community to namespace their seeders in the hooks.

marktopper avatar Feb 07 '18 11:02 marktopper

Laravel's seeder should handle that just fine. You just have to call the class explicitly with the namespace

fletch3555 avatar Feb 07 '18 12:02 fletch3555