Ive never fiddled with traits so I may be speaking out of stupidity but if I were wanting to re-use a code base across several sites id build an API that each 1 talks to and switch features on/off on their Laravel installation.
Or what about workbench packaging your code and including these common features through composer?
The reason I used a trait is because I want the relationships to work, so for example in the blog template I might want to get all the downloads using $article->downloads. If there's another way to do this without traits then I'm happy to do that. I don't quite understand how an API would help - perhaps you could expand on that?
All the features (blog/images/downloads/etc) are full packages, and I am including them with composer. This is why I don't want to touch the code within the packages on different sites except for the published configs.
Can you explain how an API would help?
I need something that I can pull this information (eg downloads attached to a blog article) out quickly and easily from a template. I'd like to be able to pull the blog article in the controller and send that to the template, the template could then use something like $article->downloads to retrieve all attached downloads.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community