renamed income/expense
This commit is contained in:
25
app/Listeners/Purchase/CreateBillCreatedHistory.php
Normal file
25
app/Listeners/Purchase/CreateBillCreatedHistory.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Purchase;
|
||||
|
||||
use App\Events\Purchase\BillCreated as Event;
|
||||
use App\Jobs\Purchase\CreateBillHistory;
|
||||
use App\Traits\Jobs;
|
||||
|
||||
class CreateBillCreatedHistory
|
||||
{
|
||||
use Jobs;
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
$message = trans('messages.success.added', ['type' => $event->bill->bill_number]);
|
||||
|
||||
$this->dispatch(new CreateBillHistory($event->bill, 0, $message));
|
||||
}
|
||||
}
|
29
app/Listeners/Purchase/SendBillRecurringNotification.php
Normal file
29
app/Listeners/Purchase/SendBillRecurringNotification.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Purchase;
|
||||
|
||||
use App\Events\Purchase\BillRecurring as Event;
|
||||
use App\Notifications\Purchase\Bill as Notification;
|
||||
|
||||
class SendBillRecurringNotification
|
||||
{
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return array
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
$bill = $event->bill;
|
||||
|
||||
// Notify all users assigned to this company
|
||||
foreach ($bill->company->users as $user) {
|
||||
if (!$user->can('read-notifications')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user->notify(new Notification($bill, 'bill_recur_admin'));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user