Support the ongoing development of Laravel.io →
Packages Architecture
Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Build API, Soap or Web Service.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

webal webal Joined 30 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.