1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Services/Scheduler/EmailRecord.php
2023-04-14 13:04:28 +10:00

38 lines
861 B
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Services\Scheduler;
use App\Models\Scheduler;
use Illuminate\Support\Str;
use App\Utils\Traits\MakesHash;
class EmailRecord
{
use MakesHash;
public function __construct(public Scheduler $scheduler)
{
}
public function run()
{
$class = 'App\\Models\\' . Str::camel($this->scheduler->parameters['entity']);
$entity = $class::find($this->decodePrimaryKey($this->scheduler->parameters['entity_id']));
if($entity)
$entity->service()->sendEmail();
$this->scheduler->forceDelete();
}
}