<?php

namespace Rvsitebuilder\Queuesharedhost\Http\Requests;

use Alfheim\Sanitizer\Laravel\FormRequest;

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

        //TODO In boiloerplate can auth role by page-action
        // return access()->hasRole(1);
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * See more: https://laravel.com/docs/5.5/validation#available-validation-rules
     *
     * @return array
     */
    public function rules()
    {
        //TODO Update validation rules
        return [
                'queue_name' => 'required|max:10',
                'queue_xx' => 'required|max:10',
        ];
    }

    /**
     * Define custom error message.
     *
     * @return array
     */
    public function messages()
    {
        //TODO language system
        return [
                'queue_name.required' => 'The "Queuesharedhost queue_name" field is required.',
                'queue_name.max' => 'The "Queuesharedhost queue_name" may not be greater than 10 characters.',
                'queue_xx.required' => 'The "Queuesharedhost queue_xx" field is required.',
                'queue_xx.max' => 'The "Queuesharedhost queue_xx" may not be greater than 10 characters.',
        ];
    }

    /**
     * Get the sanitation rules that apply to the request.
     *
     * @return array
     */
    public function sanitize()
    {
        //TODO Define santize for model ให้ไปดูเพิ่มที่ https://laravel.com/docs/5.5/helpers#available-methods
        return [
                //'title'  => 'trim|ucwords',
                //'content_html'  => 'trim|clean',
                //'meta_title' => 'trim|mb_strtolower'
        ];
    }
}
