Properly validate schedule names; closes #2405
This commit is contained in:
parent
48a104667f
commit
6a4914df3b
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Schedules;
|
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Schedules;
|
||||||
|
|
||||||
|
use Pterodactyl\Models\Schedule;
|
||||||
use Pterodactyl\Models\Permission;
|
use Pterodactyl\Models\Permission;
|
||||||
|
|
||||||
class StoreScheduleRequest extends ViewScheduleRequest
|
class StoreScheduleRequest extends ViewScheduleRequest
|
||||||
|
@ -19,13 +20,15 @@ class StoreScheduleRequest extends ViewScheduleRequest
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
$rules = Schedule::getRules();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => 'required|string|min:1',
|
'name' => $rules['name'],
|
||||||
'is_active' => 'filled|boolean',
|
'is_active' => array_merge(['filled'], $rules['is_active']),
|
||||||
'minute' => 'required|string',
|
'minute' => $rules['cron_minute'],
|
||||||
'hour' => 'required|string',
|
'hour' => $rules['cron_hour'],
|
||||||
'day_of_month' => 'required|string',
|
'day_of_month' => $rules['cron_day_of_month'],
|
||||||
'day_of_week' => 'required|string',
|
'day_of_week' => $rules['cron_day_of_week'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class Schedule extends Model
|
||||||
*/
|
*/
|
||||||
public static $validationRules = [
|
public static $validationRules = [
|
||||||
'server_id' => 'required|exists:servers,id',
|
'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_week' => 'required|string',
|
||||||
'cron_day_of_month' => 'required|string',
|
'cron_day_of_month' => 'required|string',
|
||||||
'cron_hour' => 'required|string',
|
'cron_hour' => 'required|string',
|
||||||
|
|
Loading…
Reference in New Issue