Skip to content
Advertisement

How to pass multiple array in response – Laravel API

I am creating my API for mobile app in Laravel. I am facing an issue where I have to pass two arrays as json but it shows error. Here is the code which I am using

JavaScript

and it shows me this error

Symfony Component Debug Exception FatalThrowableError (E_RECOVERABLE_ERROR) Argument 2 passed to SymfonyComponentHttpFoundationJsonResponse::__construct() must be of the type integer, array given, called in

Any idea how can I pass two or multiple arrays? Thanks

Advertisement

Answer

Create array from your data as:

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