phpvms/app/Cron/Nightly/ApplyExpenses.php
Nabeel S 936cd2efd3
Implement PIREP deletion #1014 (#1055)
* Implement PIREP deletion #1014

* Style fixes

* Add delete button to PIREP listing page

* Remove extra import
2021-03-02 15:43:34 -05:00

43 lines
1006 B
PHP

<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Enums\ExpenseType;
use App\Services\Finance\RecurringFinanceService;
use Illuminate\Support\Facades\Log;
/**
* Go through and apply any finances that are daily
*/
class ApplyExpenses extends Listener
{
private $financeSvc;
/**
* ApplyExpenses constructor.
*
* @param RecurringFinanceService $financeSvc
*/
public function __construct(RecurringFinanceService $financeSvc)
{
$this->financeSvc = $financeSvc;
}
/**
* Apply all of the expenses for a day
*
* @param CronNightly $event
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function handle(CronNightly $event): void
{
Log::info('Nightly: Applying daily expenses');
$this->financeSvc->processExpenses(ExpenseType::DAILY);
}
}