staudenmeir / eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels
MIT License
2.67k stars 157 forks source link

Auto register ide-helper hook using Package Discovery #215

Closed daniel-de-wit closed 11 months ago

daniel-de-wit commented 1 year ago

Would you consider automatically registering the model hook using Package Discovery?

staudenmeir commented 1 year ago

Hi @daniel-de-wit, Thanks, I'll take a look.

daniel-de-wit commented 1 year ago

@staudenmeir I've updated the PR to make the service provider deferred, just like the one from IDEHelper. This ensures the order of package discovery doesn't effect the registration of the model hook. Now it only registers after the ModelsCommand is requested from the service container, which removed the need for a couple of environment guards.

I would like to hear your take on it

staudenmeir commented 11 months ago

Thanks, excellent PR! I've released a new version.

staudenmeir commented 11 months ago

One last question: You kept and even improved the README section about manually enabling the model hook.

Do you still see a use case for that?

daniel-de-wit commented 11 months ago

I added that for people that have package discovery disabled. I never encountered a project that disabled the entire package discovery though.

staudenmeir commented 11 months ago

Ok, thanks.