<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class LanguageController extends Controller
{
    public function changeLanguage(Request $request, $locale)
    {
        if (in_array($locale, config('app.locales'))) {
            $request->session()->put('locale', $locale);
        }
        return redirect()->back();
    }
}