added bill received event
This commit is contained in:
29
app/Listeners/Purchase/MarkBillReceived.php
Normal file
29
app/Listeners/Purchase/MarkBillReceived.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Purchase;
|
||||
|
||||
use App\Events\Purchase\BillReceived as Event;
|
||||
use App\Jobs\Purchase\CreateBillHistory;
|
||||
use App\Traits\Jobs;
|
||||
|
||||
class MarkBillReceived
|
||||
{
|
||||
use Jobs;
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
if ($event->bill->status != 'partial') {
|
||||
$event->bill->status = 'received';
|
||||
|
||||
$event->bill->save();
|
||||
}
|
||||
|
||||
$this->dispatch(new CreateBillHistory($event->bill, 0, trans('bills.mark_received')));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user