问题
I was wondering if there's a way to integrate this with guzzle? I'm calling an external restful api. I'm new to Datatable so not sure if it's possible. Right now i'm just doing a foreach in my view. How to integrate this with chumper datatable?
Controller
public function getIndex() {
$client = new \GuzzleHttp\Client();
$response = $client->get('http://api.company.com/members');
$body = json_decode($response->getBody());
$content = view('members')->with('members',$body);
return Admin::view($content, 'Members');
}
View
@foreach ($members as $member)
<tr>
<td>{{ $member->name }}</td>
<td>{{ $member->email }}</td>
<td>{{ $member->phone }}</td>
</tr>
@endforeach
来源:https://stackoverflow.com/questions/30056351/laravel-5-guzzle-with-chumper-datatable