Next I'm making a request of type get
and it's returning me a objeto
and I'd like it to be an array,
already tried to use
$dados= Array.of($response->getBody()->getContents());
But of the error! error
Parse error: syntax error, unexpected '.', expecting '('
MY CODES - >
web.api
use GuzzleHttp\Client;
Route::get('/', function () {
$client = new Client([
// Base URI is used with relative requests
'base_uri' => 'https://teste.herokuapp.com',
// You can set any number of default request options.
'timeout' => 2.0,
]);
$response = $client->request('GET', 'api/login');
$dados= $response->getBody()->getContents();
dd($dados);
return view('posts.index', compact('dados'));
});
dd ($ data)
"{"contas":[{"id":7,"email":"[email protected]","senha":"4154512"},{"id":1,"email":"[email protected]","senha":"lucas123"},{"id":14,"email":"[email protected] "