2022-05-25 00:06:42 +02:00
|
|
|
<?php
|
2022-05-25 23:26:38 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
2022-05-25 00:06:42 +02:00
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
use App\Models\Scheduler;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
2023-01-13 02:43:38 +01:00
|
|
|
class SchedulerTransformer extends EntityTransformer
|
2022-05-25 00:06:42 +02:00
|
|
|
{
|
|
|
|
use MakesHash;
|
|
|
|
|
|
|
|
public function transform(Scheduler $scheduler)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => $this->encodePrimaryKey($scheduler->id),
|
2023-01-13 02:43:38 +01:00
|
|
|
'name' => (string) $scheduler->name,
|
|
|
|
'frequency_id' => (string) $scheduler->frequency_id,
|
2023-01-17 09:42:34 +01:00
|
|
|
'next_run' => $scheduler->next_run_client->format('Y-m-d'),
|
2023-01-13 02:43:38 +01:00
|
|
|
'template' => (string) $scheduler->template,
|
|
|
|
'is_paused' => (bool) $scheduler->is_paused,
|
|
|
|
'is_deleted' => (bool) $scheduler->is_deleted,
|
|
|
|
'parameters'=> (array) $scheduler->parameters,
|
2022-06-21 11:57:17 +02:00
|
|
|
'is_deleted' => (bool) $scheduler->is_deleted,
|
|
|
|
'updated_at' => (int) $scheduler->updated_at,
|
|
|
|
'created_at' => (int) $scheduler->created_at,
|
2022-05-26 04:29:57 +02:00
|
|
|
'archived_at' => (int) $scheduler->deleted_at,
|
2022-05-25 00:06:42 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|