<?php

namespace Rvsitebuilder\Wysiwyg\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class MenuSelectRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function authorize()
    {
        return $this->user()->isAdmin();
    }

    public function rules()
    {
        return [
            'type' => 'required|numeric|max:3',
        ];
    }

    public function messages()
    {
        //TODO language system
        return [
                'type.required' => __('wysiwyg::blog.validate.MenuSelect.type.required'),
                'type.numeric' => __('wysiwyg::blog.validate.MenuSelect.type.numeric'),
        ];
    }

    public function sanitize()
    {
        //TODO Define santize for model ให้ไปดูเพิ่มที่ https://laravel.com/docs/5.5/helpers#available-methods
        return [
                'type' => 'clean',
        ];
    }

    /*
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
}
