<?php

namespace App\Http\Requests\Dashboard;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        return [
            'check_vedio_or_image' => 'required',
            'type_video' => 'required_if:check_vedio_or_image,video',
            'title_ar' => 'required',
            'title_en' => 'required',
            'desc_ar' => 'required',
            'desc_en' => 'required',
            'photo' => 'required_if:check_vedio_or_image,image',
            'video_youtube' => 'required_if:type_video,youtube',
            'video_device' => 'required_if:type_video,device',
            'link' => 'required|url'
        ];

        // return [
        //     'check_vedio_or_image' => 'required',
        //     'file' => 'required_if:check_vedio_or_image,image|mimes:png,jpg,jpeg',
        //     'url' => ['required_if:check_vedio_or_image,vedio|regex:/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/i'],
        // ];

    }
}
