1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Added back API route for quotes

This commit is contained in:
Hillel Coren 2016-06-06 22:18:15 +03:00
parent 80202b6d92
commit 1eb334f3b4
2 changed files with 53 additions and 2 deletions

View File

@ -0,0 +1,52 @@
<?php namespace App\Http\Controllers;
use Auth;
use Input;
use Utils;
use Response;
use App\Models\Invoice;
use App\Ninja\Repositories\InvoiceRepository;
use App\Http\Controllers\BaseAPIController;
use App\Ninja\Transformers\QuoteTransformer;
class QuoteApiController extends BaseAPIController
{
protected $invoiceRepo;
protected $entityType = ENTITY_INVOICE;
public function __construct(InvoiceRepository $invoiceRepo)
{
parent::__construct();
$this->invoiceRepo = $invoiceRepo;
}
/**
* @SWG\Get(
* path="/quotes",
* tags={"quote"},
* summary="List of quotes",
* @SWG\Response(
* response=200,
* description="A list with quotes",
* @SWG\Schema(type="array", @SWG\Items(ref="#/definitions/Invoice"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function index()
{
$invoices = Invoice::scope()
->withTrashed()
->where('is_quote', '=', '1')
->with('invoice_items', 'client')
->orderBy('created_at', 'desc');
return $this->listResponse($invoices);
}
}

View File

@ -251,8 +251,7 @@ Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function()
Route::get('accounts', 'AccountApiController@show');
Route::put('accounts', 'AccountApiController@update');
Route::resource('clients', 'ClientApiController');
//Route::get('quotes', 'QuoteApiController@index');
//Route::resource('quotes', 'QuoteApiController');
Route::get('quotes', 'QuoteApiController@index');
Route::get('invoices', 'InvoiceApiController@index');
Route::get('download/{invoice_id}', 'InvoiceApiController@download');
Route::resource('invoices', 'InvoiceApiController');