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 21:48:02 +02:00
|
|
|
$response = [
|
|
|
|
'status' => 200,
|
|
|
|
'error' => false,
|
|
|
|
'clients' => $clients->toArray()
|
|
|
|
];
|
|
|
|
|
|
|
|
$response = json_encode($response, JSON_PRETTY_PRINT);
|
|
|
|
|
|
|
|
return Response::make($response, 200, ['Content-Type' => 'application/json']);
|
2014-05-13 21:20:54 +02:00
|
|
|
}
|
|
|
|
}
|