2
I’m starting with Laravel, seeing from Rails, where to return a JSON I just put . json in the url, the return processing is obviously in the Controller.
My question is how to do something like Laravel. I would like, instead of creating a method to return html and another one to json, to have only one for both and in the view I could determine what the return would be.
public function lista(){
$produtos = 'select na tabela';
return view('produtos.listagem')->withProdutos($produtos);
}
The above code returns htmlby default, you would choose the return type?
Hugs
http://stackoverflow.com/questions/32573457/laravel-5-return-html-or-json-depending-on-route
– Daniel Omine