diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php index 618cd9f4e..a8dfbc3a4 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php @@ -2,6 +2,7 @@ namespace Pterodactyl\Http\Requests\Api\Client\Servers\Schedules; +use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Permission; class StoreScheduleRequest extends ViewScheduleRequest @@ -19,13 +20,15 @@ class StoreScheduleRequest extends ViewScheduleRequest */ public function rules(): array { + $rules = Schedule::getRules(); + return [ - 'name' => 'required|string|min:1', - 'is_active' => 'filled|boolean', - 'minute' => 'required|string', - 'hour' => 'required|string', - 'day_of_month' => 'required|string', - 'day_of_week' => 'required|string', + 'name' => $rules['name'], + 'is_active' => array_merge(['filled'], $rules['is_active']), + 'minute' => $rules['cron_minute'], + 'hour' => $rules['cron_hour'], + 'day_of_month' => $rules['cron_day_of_month'], + 'day_of_week' => $rules['cron_day_of_week'], ]; } } diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index 384d354ad..bc214f27d 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -103,7 +103,7 @@ class Schedule extends Model */ public static $validationRules = [ 'server_id' => 'required|exists:servers,id', - 'name' => 'nullable|string|max:255', + 'name' => 'required|string|max:255', 'cron_day_of_week' => 'required|string', 'cron_day_of_month' => 'required|string', 'cron_hour' => 'required|string',