<?php

namespace App\Http\Requests\Backend\Faqs;

use Illuminate\Foundation\Http\FormRequest;

class StoreFaqsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return access()->allow('create-faq');
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'question'  => 'required|max:191',
            'answer'    => 'required'
        ];
    }

    /**
     * Show the Messages for rules above
     *
     * @return array
     */
    public function messages()
    {
        return [
            'question.required'  => 'Question field is required.',
            'question.max'  => 'Question may not be grater than 191 character.',
            'answer.required'    => 'Answer field is required.'
        ];
    }
}
