Skip to content
Advertisement

Laravel API controller return object along with other arguments

In API controller index function $response holds id's of media items from db table

JavaScript

And if $is_published_pack == 'false'

I’m successfully returning

JavaScript

How to append $response inside when $is_published_pack true condition is met?

$response value is

JavaScript

I’ve tried for example doing this but it throws error

JavaScript

Complete API controller index function:

JavaScript

Advertisement

Answer

you may try this:

JavaScript

hope this solves your issue.

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