v2 first commit

This commit is contained in:
denisdulici
2019-11-16 10:21:14 +03:00
parent 5b23e9c2c4
commit 6d50fa8442
3075 changed files with 3451681 additions and 65594 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Listeners\Expense;
use App\Events\Expense\BillCreated as Event;
use App\Jobs\Expense\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));
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Listeners\Expense;
use App\Events\Expense\BillRecurring as Event;
use App\Notifications\Expense\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'));
}
}
}