mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #642 from sakalauskas/dev-api
Fixed ping route & added a way to find client by email address or if …
This commit is contained in:
commit
e4a6effc60
@ -48,8 +48,19 @@ class ClientApiController extends BaseAPIController
|
|||||||
{
|
{
|
||||||
$clients = Client::scope()
|
$clients = Client::scope()
|
||||||
->with($this->getIncluded())
|
->with($this->getIncluded())
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc');
|
||||||
->paginate();
|
|
||||||
|
// Filter by email
|
||||||
|
if (Input::has('email')) {
|
||||||
|
|
||||||
|
$email = Input::get('email');
|
||||||
|
$clients = $clients->whereHas('contacts', function ($query) use ($email) {
|
||||||
|
$query->where('email', $email);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$clients = $clients->paginate();
|
||||||
|
|
||||||
$transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer'));
|
$transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer'));
|
||||||
$paginator = Client::scope()->paginate();
|
$paginator = Client::scope()->paginate();
|
||||||
@ -83,7 +94,7 @@ class ClientApiController extends BaseAPIController
|
|||||||
public function store(CreateClientRequest $request)
|
public function store(CreateClientRequest $request)
|
||||||
{
|
{
|
||||||
$client = $this->clientRepo->save($request->input());
|
$client = $this->clientRepo->save($request->input());
|
||||||
|
|
||||||
$client = Client::scope($client->public_id)
|
$client = Client::scope($client->public_id)
|
||||||
->with('country', 'contacts', 'industry', 'size', 'currency')
|
->with('country', 'contacts', 'industry', 'size', 'currency')
|
||||||
->first();
|
->first();
|
||||||
|
@ -209,7 +209,7 @@ Route::group(['middleware' => 'auth'], function() {
|
|||||||
// Route groups for API
|
// Route groups for API
|
||||||
Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function()
|
Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function()
|
||||||
{
|
{
|
||||||
Route::resource('ping', 'ClientApiController@ping');
|
Route::get('ping', 'ClientApiController@ping');
|
||||||
Route::post('login', 'AccountApiController@login');
|
Route::post('login', 'AccountApiController@login');
|
||||||
Route::get('static', 'AccountApiController@getStaticData');
|
Route::get('static', 'AccountApiController@getStaticData');
|
||||||
Route::get('accounts', 'AccountApiController@show');
|
Route::get('accounts', 'AccountApiController@show');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user