1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/controllers/ClientApiController.php

44 lines
1.2 KiB
PHP
Raw Normal View History

2014-05-13 21:20:54 +02:00
<?php
use ninja\repositories\ClientRepository;
use Client;
class ClientApiController extends \BaseController {
protected $clientRepo;
public function __construct(ClientRepository $clientRepo)
{
parent::__construct();
$this->clientRepo = $clientRepo;
}
public function index()
{
2014-05-13 21:48:02 +02:00
$clients = Client::scope()->get();
2014-05-13 21:20:54 +02:00
2014-05-13 22:24:40 +02:00
/*
2014-05-13 21:48:02 +02:00
$response = [
'status' => 200,
'error' => false,
'clients' => $clients->toArray()
];
2014-05-13 22:24:40 +02:00
*/
$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,
];
2014-05-13 21:48:02 +02:00
2014-05-13 22:24:40 +02:00
return Response::make($response, 200, $headers);
2014-05-13 21:20:54 +02:00
}
}