Skip to content
Advertisement

Laravel how merge two query results into a single object

I’m currently stuck on how to merge two query results into a single object . Below is my code.

EDITED

Model methods

JavaScript

Getting values in controller

JavaScript

Returned result: [{'teamstanding': 'data'}, {'teamstatictics': 'data'}]

Expected output: [{'teamstanding': 'data', 'teamstatictics': 'data'}]

Advertisement

Answer

You can use all() function.

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