<?php

namespace LaraBB\Translate\UI\Web\Requests;

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

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

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

        ];
    }

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

        ];
    }

    /**
     * @return RedirectResponse
     */
    public function success(): RedirectResponse
    {
        return redirect()->route('translate-index', [$this->get('lang')])->with([
            'success' => __('Your translation has been saved.')
        ]);
    }

    /**
     * @return RedirectResponse
     */
    public function failed(): RedirectResponse
    {
        return redirect()->route('translate-index', [$this->get('lang')])->with([
            'error' => __('Due to technical difficulties your translations could not be saved.')
        ]);
    }
}
