mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-17 13:53:45 +02:00
Adds months for schedules
Adds month variable for schedules
This commit is contained in:
@@ -12,6 +12,7 @@ use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
||||
* @property int $server_id
|
||||
* @property string $name
|
||||
* @property string $cron_day_of_week
|
||||
* @property string $cron_month
|
||||
* @property string $cron_day_of_month
|
||||
* @property string $cron_hour
|
||||
* @property string $cron_minute
|
||||
@@ -58,6 +59,7 @@ class Schedule extends Model
|
||||
'server_id',
|
||||
'name',
|
||||
'cron_day_of_week',
|
||||
'cron_month',
|
||||
'cron_day_of_month',
|
||||
'cron_hour',
|
||||
'cron_minute',
|
||||
@@ -93,6 +95,7 @@ class Schedule extends Model
|
||||
protected $attributes = [
|
||||
'name' => null,
|
||||
'cron_day_of_week' => '*',
|
||||
'cron_month' => '*',
|
||||
'cron_day_of_month' => '*',
|
||||
'cron_hour' => '*',
|
||||
'cron_minute' => '*',
|
||||
@@ -107,6 +110,7 @@ class Schedule extends Model
|
||||
'server_id' => 'required|exists:servers,id',
|
||||
'name' => 'required|string|max:191',
|
||||
'cron_day_of_week' => 'required|string',
|
||||
'cron_month' => 'required|string',
|
||||
'cron_day_of_month' => 'required|string',
|
||||
'cron_hour' => 'required|string',
|
||||
'cron_minute' => 'required|string',
|
||||
@@ -123,7 +127,7 @@ class Schedule extends Model
|
||||
*/
|
||||
public function getNextRunDate()
|
||||
{
|
||||
$formatted = sprintf('%s %s %s * %s', $this->cron_minute, $this->cron_hour, $this->cron_day_of_month, $this->cron_day_of_week);
|
||||
$formatted = sprintf('%s %s %s %s %s', $this->cron_minute, $this->cron_hour, $this->cron_day_of_month, $this->cron_month, $this->cron_day_of_week);
|
||||
|
||||
return CarbonImmutable::createFromTimestamp(
|
||||
CronExpression::factory($formatted)->getNextRunDate()->getTimestamp()
|
||||
|
||||
Reference in New Issue
Block a user