Skip to content
Advertisement

return array from command to controller. Laravel [closed]

I have an array in my command and I want to return the array to a controller where I call the command. This is what I want. Command :

JavaScript

Controller :

JavaScript

I have also tried this:

JavaScript

But they both don’t work. Please help?

Advertisement

Answer

You can’t get the result of your command back in your controller, (you will only get the “text” from it)

Instead if you want directly a php array, try to export your command’s code in a helper function (or in the model you are using in your command), then call it from your controller and your command.

If you can’t do that, try this in your handle() function:

JavaScript

then in your controller :

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