<?php

namespace LaraBB\Translate\UI\Web\Handlers;

use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

/**
 * Class TranslateTestHandler
 * @package LaraBB\Translate\UI\Web\Handlers
 */
class TranslateTestHandler extends Controller
{
    /**
     * TranslateTestHandler constructor.
     */
    public function __construct()
    {

    }

    /**
     * @param Request $request
     * @return RedirectResponse
     */
    public function __invoke(Request $request): RedirectResponse
    {
        session()->put(['lang' => $request->post('lang')]);

        return redirect()->route('translate-index', [$request->post('lang')]);
    }
}
