1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/app/Services/Scheduler/EmailRecord.php
2023-10-26 13:57:44 +11:00

39 lines
873 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 App\Utils\Traits\MakesHash;
use Illuminate\Support\Str;
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();
}
}