<?php

namespace App\Http\Requests;

use App\Libs\Security\XSSCleanFilter;
use Waavi\Sanitizer\Laravel\SanitizesInput;

class UserLogin extends BaseFormRequest
{

    use SanitizesInput;

    /**
     * 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 [
            'email' => 'required|max:150|email',
            'password' => 'required'
        ];
    }

    /**
     * Filters to be applied to the input.
     *
     * @return array
     */
    public function filters()
    {
        return [
            'email' => "lowercase"
        ];
    }

    public function customFilters()
    {
        return ['xss_clean' => XSSCleanFilter::class];
    }
}
