<?php

namespace LaraBB\User\UI\Web\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\RedirectResponse;

/**
 * Class Logout
 * @package LaraBB\User\UI\Web\Requests
 */
class Logout extends FormRequest
{
    /**
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * @return array
     */
    public function rules(): array
    {
        return [];
    }

    /**
     * @return array
     */
    public function messages(): array
    {
        return [];
    }

    /**
     * @return RedirectResponse
     */
    public function success(): RedirectResponse
    {
        return redirect()->back()->with([
            'success' => __('You have been successfully logged out.')
        ]);
    }

    /**
     * @return RedirectResponse
     */
    public function failed(): RedirectResponse
    {
        return redirect()->back()->with([
            'error' => __('Due to a technical problem, you could not be logged out.')
        ]);
    }
}
