Your IP : 216.73.216.79


Current Path : /var/www/html/reddsis/app/Http/Requests/Backend/
Upload File :
Current File : /var/www/html/reddsis/app/Http/Requests/Backend/ContentApplicationRequest.php

<?php

namespace App\Http\Requests\Backend;

use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;

class ContentApplicationRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'application_cat' => 'nullable|string|max:255',
            'application_status' => 'nullable|string|max:255',
            'application_url' => 'nullable|string|max:255',
            'application_img' => 'nullable|image|mimes:jpg,jpeg,png,webp|max:2048',
            'application_sort' => 'nullable|integer|min:0',

            // Translations
            'translations' => 'nullable|array',
            'translations.*.title' => 'nullable|string|max:255',
            'translations.*.language' => 'nullable|string|max:255',
            'translations.*.main' => 'nullable|boolean',
        ];
    }

    /**
     * Get custom messages for validation errors.
     *
     * @return array<string, string>
     */
    public function messages(): array
    {
        return [
            'application_sort.integer' => 'Sort order must be a number.',
            'application_sort.min' => 'Sort order must be at least 0.',
        ];
    }
}