Files
backend-mm/app/Http/Requests/Api/System/VersionManagement/CheckForUpdateRequest.php
2025-09-25 03:03:31 +05:00

36 lines
922 B
PHP

<?php
namespace App\Http\Requests\Api\System\VersionManagement;
use App\Models\System\Settings\OS;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class CheckForUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
'version' => ['required', 'string', 'max:255'],
'os' => ['required', 'string', 'max:255', Rule::in(array_keys(OS::apps()))],
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'os.in' => sprintf('Valid sources: %s', implode(', ', array_keys(OS::apps()))),
];
}
}