repuve-backend-v1/app/Http/Requests/Repuve/BoxUpdateRequest.php

33 lines
863 B
PHP

<?php
namespace App\Http\Requests\Repuve;
use Illuminate\Foundation\Http\FormRequest;
class BoxUpdateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'box_number' => ['nullable', 'string', 'max:100'],
'package_id' => ['nullable', 'integer', 'exists:packages,id'],
'starting_page' => ['nullable', 'integer', 'min:1'],
'ending_page' => ['nullable', 'integer', 'gt:starting_page'],
];
}
public function messages(): array
{
return [
'package_id.exists' => 'El paquete no existe',
'starting_page.min' => 'La página inicial debe ser al menos 1',
'ending_page.gt' => 'La página final debe ser mayor a la página inicial',
];
}
}