Code improvements
This commit is contained in:
@@ -24,7 +24,7 @@ class CreateInvoiceCommand {
|
||||
}
|
||||
|
||||
$invoice = Invoice::create([
|
||||
'tenant' => app('tenant')->slug,
|
||||
'tenant' => currentTenant()->slug,
|
||||
'cost_unit_id' => $this->request->costUnit->id,
|
||||
'invoice_number' => $this->generateInvoiceNumber(),
|
||||
'status' => InvoiceStatus::INVOICE_STATUS_NEW,
|
||||
@@ -61,7 +61,7 @@ class CreateInvoiceCommand {
|
||||
}
|
||||
|
||||
if ($this->request->costUnit->mail_on_new) {
|
||||
$recipients = [app('tenant')->email_finance];
|
||||
$recipients = [currentTenant()->email_finance];
|
||||
|
||||
foreach ($this->request->costUnit->treasurers()->get() as $treasurer) {
|
||||
if (!in_array($treasurer->email, $recipients)) {
|
||||
@@ -83,7 +83,7 @@ class CreateInvoiceCommand {
|
||||
|
||||
private function generateInvoiceNumber() : string {
|
||||
$lastInvoiceNumber = Invoice::query()
|
||||
->where('tenant', app('tenant')->slug)
|
||||
->where('tenant', currentTenant()->slug)
|
||||
->whereYear('created_at', date('Y'))
|
||||
->count();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user