<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

/**
 * Class LoginPostRequest
 *
 * @package App\Http\Requests
 */
class LoginPostRequest 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 [
            'login' => 'required|min:7|max:50',
            'password' => 'required|min:3|max:70'
        ];
    }

    /**
     * Set custom messages for validator errors.
     *
     * @return array
     */
    public function messages()
    {
        return [
            'login.required' => 'Prihlasovacie meno je vyžadované',
            'login.min' => 'Minimálna dĺžka prihlasovacieho mena je :min znakov',
            'login.max' => 'Maximálna dĺžka prihlasovacieho mena je :max znakov',
            'password.required' => 'Heslo je vyžadované',
            'password.min' => 'Minimálna dĺžka hesla je :min znakov',
            'password.max' => 'Maximálna dĺžka hesla je :max znakov'
        ];
    }
}
