How to register custom developed Laravel packages dynamically?

Viewed 18

I had created two Laravel packages name productv1 and productv2 same functionalities with different logic. both has service providers named ProductV1ServiceProvider and ProductV2ServiceProvider.

Suppose there are two users. for UserA needs to allow only ProductV1ServiceProvider and UserB needs to allow ProductV2ServiceProvider only.

in the service providers we cannot access Auth::user and view:share is not a solution for this scenario.

So how to enable custom packages for specific users?

Furthermore

UserA ========> ProductV1ServiceProvider
 /products ---> ProductV1Package/Controllers/ProductController@index

UserB ========> ProductV2ServiceProvider
 /products ---> ProductV2Package/Controllers/ProductController@index

***FYI - single user can be access only one package and package path and anything can be stored in database. ***

0 Answers
Related