-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5eb87d
commit 8b50c5d
Showing
7 changed files
with
280 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Insane\Journal\Jobs\Invoice; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Insane\Journal\Models\Invoice\Invoice; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Foundation\Bus\Dispatchable; | ||
|
||
class CreateExpenseDetails implements ShouldQueue | ||
{ | ||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||
|
||
protected $invoice; | ||
protected $formData; | ||
/** | ||
* Create a new job instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Invoice $invoice, $formData) | ||
{ | ||
$this->invoice = $invoice; | ||
$this->formData = $formData; | ||
} | ||
|
||
/** | ||
* Execute the job. | ||
* | ||
* @return void | ||
*/ | ||
public function handle() | ||
{ | ||
if (isset($this->formData['expense_details']) && $this->invoice->type == Invoice::DOCUMENT_TYPE_BILL) { | ||
$expense = $this->formData['expense_details']; | ||
$this->invoice->expenseDetails()->create([ | ||
'customer_id' => $expense['customer_id'], | ||
'payment_account_id' => $expense['customer_id'], | ||
'is_personal' => $expense['is_personal'], | ||
'is_billable' => $expense['is_billable'], | ||
'expense_type' => $expense['expense_type'] | ||
]); | ||
} | ||
} | ||
} |
Oops, something went wrong.