use trait in api

This commit is contained in:
denisdulici 2018-11-03 12:40:43 +03:00
parent b80a972151
commit 9709899941

View File

@ -14,12 +14,13 @@ use App\Models\Income\InvoiceTotal;
use App\Models\Common\Item; use App\Models\Common\Item;
use App\Models\Setting\Tax; use App\Models\Setting\Tax;
use App\Notifications\Common\Item as ItemNotification; use App\Notifications\Common\Item as ItemNotification;
use App\Traits\Incomes;
use App\Transformers\Income\Invoice as Transformer; use App\Transformers\Income\Invoice as Transformer;
use Dingo\Api\Routing\Helpers; use Dingo\Api\Routing\Helpers;
class Invoices extends ApiController class Invoices extends ApiController
{ {
use Helpers; use Helpers, Incomes;
/** /**
* Display a listing of the resource. * Display a listing of the resource.
@ -163,9 +164,7 @@ class Invoices extends ApiController
InvoiceHistory::create($request->input()); InvoiceHistory::create($request->input());
// Update next invoice number // Update next invoice number
$next = setting('general.invoice_number_next', 1) + 1; $this->increaseNextInvoiceNumber();
setting(['general.invoice_number_next' => $next]);
setting()->save();
// Fire the event to make it extendible // Fire the event to make it extendible
event(new InvoiceCreated($invoice)); event(new InvoiceCreated($invoice));