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/FrontendSiteRequest.php

<?php

namespace App\Http\Requests\Backend;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class FrontendSiteRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        $id = $this->route('site');

        return [
            'name' => 'required|string|max:255',
            'slug' => [
                'required',
                'string',
                'max:255',
                Rule::unique('frontend_sites', 'slug')->ignore($id),
            ],
            'header_fk' => 'nullable|integer|exists:frontend_components,id',
            'footer_fk' => 'nullable|integer|exists:frontend_components,id',
            'layout' => 'nullable|string',
            'status' => 'nullable|boolean',
            'is_default' => 'nullable|boolean',
            'sort_order' => 'nullable|integer|min:0',
        ];
    }

    public function messages(): array
    {
        return [
            'slug.unique' => 'Site slug already exists.',
            'header_fk.exists' => 'Selected header component not found.',
            'footer_fk.exists' => 'Selected footer component not found.',
        ];
    }
}