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

You don't want to duplicate code. That makes sense, you'd have to change multiple places if the code needed to change.

The way to solve for this is not to have controllers interact with one another. It's to create an object that is responsible for something that you need, and injecting it into each controller that you need. In this way you can use the functionality all over the place.

Last updated 2 years ago.
0

ShawnMcCool said:

create an object that is responsible for something that you need

Like a global variable?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

neon5 neon5 Joined 21 Feb 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.