Skip to content
Advertisement

Laravel merge relationships

Is there a way to merge 2 relationships in laravel?

this is the way it’s setup now, but Is there a way I could return both merged?

JavaScript

Advertisement

Answer

Try out getter method for property which returns merged collections returned from relations.

JavaScript

Or you can call additional methods before collection is returned to get different result sets.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement