Working on API

This commit is contained in:
Hillel Coren 2014-05-13 23:24:40 +03:00
parent d42712204c
commit 2431c3828b

View File

@ -18,14 +18,27 @@ class ClientApiController extends \BaseController {
{
$clients = Client::scope()->get();
/*
$response = [
'status' => 200,
'error' => false,
'clients' => $clients->toArray()
];
*/
$response = json_encode($response, JSON_PRETTY_PRINT);
$response = json_encode($clients->toArray(), JSON_PRETTY_PRINT);
$headers = [
'Content-Type' => 'application/json',
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET',
//'Access-Control-Allow-Headers' => 'Origin, Content-Type, Accept, Authorization, X-Requested-With',
//'Access-Control-Allow-Credentials' => 'true',
//'X-Total-Count' => 0
//'X-Rate-Limit-Limit' - The number of allowed requests in the current period
//'X-Rate-Limit-Remaining' - The number of remaining requests in the current period
//'X-Rate-Limit-Reset' - The number of seconds left in the current period,
];
return Response::make($response, 200, ['Content-Type' => 'application/json']);
return Response::make($response, 200, $headers);
}
}