mirror of
https://github.com/pelican-dev/panel.git
synced 2026-07-16 04:03:50 +03:00
Remove unnecessary nullsafe operator on left side of ??
This commit is contained in:
@@ -39,7 +39,7 @@ class CreateSchedule extends CreateRecord
|
|||||||
$data['server_id'] = $server->id;
|
$data['server_id'] = $server->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$timezone = $data['timezone'] ?? user()?->timezone ?? 'UTC';
|
$timezone = $data['timezone'] ?? user()->timezone ?? 'UTC';
|
||||||
unset($data['timezone']);
|
unset($data['timezone']);
|
||||||
|
|
||||||
if (!isset($data['next_run_at'])) {
|
if (!isset($data['next_run_at'])) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class EditSchedule extends EditRecord
|
|||||||
|
|
||||||
protected function mutateFormDataBeforeSave(array $data): array
|
protected function mutateFormDataBeforeSave(array $data): array
|
||||||
{
|
{
|
||||||
$timezone = $data['timezone'] ?? user()?->timezone ?? 'UTC';
|
$timezone = $data['timezone'] ?? user()->timezone ?? 'UTC';
|
||||||
unset($data['timezone']);
|
unset($data['timezone']);
|
||||||
|
|
||||||
$data['next_run_at'] = ScheduleResource::getNextRun(
|
$data['next_run_at'] = ScheduleResource::getNextRun(
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class ScheduleResource extends Resource
|
|||||||
Section::make('Cron')
|
Section::make('Cron')
|
||||||
->label(trans('server/schedule.cron'))
|
->label(trans('server/schedule.cron'))
|
||||||
->description(function (Get $get) {
|
->description(function (Get $get) {
|
||||||
$timezone = $get('timezone') ?? user()?->timezone ?? 'UTC';
|
$timezone = $get('timezone') ?? user()->timezone ?? 'UTC';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$nextRun = Utilities::getScheduleNextRunDate($get('cron_minute'), $get('cron_hour'), $get('cron_day_of_month'), $get('cron_month'), $get('cron_day_of_week'), $timezone)->timezone($timezone);
|
$nextRun = Utilities::getScheduleNextRunDate($get('cron_minute'), $get('cron_hour'), $get('cron_day_of_month'), $get('cron_month'), $get('cron_day_of_week'), $timezone)->timezone($timezone);
|
||||||
@@ -300,7 +300,7 @@ class ScheduleResource extends Resource
|
|||||||
Select::make('timezone')
|
Select::make('timezone')
|
||||||
->label(trans('server/schedule.timezone'))
|
->label(trans('server/schedule.timezone'))
|
||||||
->options(fn () => array_combine(timezone_identifiers_list(), timezone_identifiers_list()))
|
->options(fn () => array_combine(timezone_identifiers_list(), timezone_identifiers_list()))
|
||||||
->default(user()?->timezone ?? 'UTC')
|
->default(user()->timezone ?? 'UTC')
|
||||||
->searchable()
|
->searchable()
|
||||||
->live()
|
->live()
|
||||||
->hiddenOn('view'),
|
->hiddenOn('view'),
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class ScheduleController extends ClientApiController
|
|||||||
'cron_minute' => $request->input('minute'),
|
'cron_minute' => $request->input('minute'),
|
||||||
'is_active' => (bool) $request->input('is_active'),
|
'is_active' => (bool) $request->input('is_active'),
|
||||||
'only_when_online' => (bool) $request->input('only_when_online'),
|
'only_when_online' => (bool) $request->input('only_when_online'),
|
||||||
'next_run_at' => $this->getNextRunAt($request, $request->user()?->timezone ?? 'UTC'),
|
'next_run_at' => $this->getNextRunAt($request, $request->user()->timezone ?? 'UTC'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Activity::event('server:schedule.create')
|
Activity::event('server:schedule.create')
|
||||||
@@ -131,7 +131,7 @@ class ScheduleController extends ClientApiController
|
|||||||
'cron_minute' => $request->input('minute'),
|
'cron_minute' => $request->input('minute'),
|
||||||
'is_active' => $active,
|
'is_active' => $active,
|
||||||
'only_when_online' => (bool) $request->input('only_when_online'),
|
'only_when_online' => (bool) $request->input('only_when_online'),
|
||||||
'next_run_at' => $this->getNextRunAt($request, $request->user()?->timezone ?? 'UTC'),
|
'next_run_at' => $this->getNextRunAt($request, $request->user()->timezone ?? 'UTC'),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Toggle the processing state of the scheduled task when it is enabled or disabled so that an
|
// Toggle the processing state of the scheduled task when it is enabled or disabled so that an
|
||||||
|
|||||||
Reference in New Issue
Block a user