2021-03-03 08:26:20 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use Illuminate\Http\Request;
|
2022-03-02 12:19:52 +01:00
|
|
|
use App\LaravelGettext\Facades\LaravelGettext;
|
2021-03-03 08:26:20 +01:00
|
|
|
|
|
|
|
class Language
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle(Request $request, Closure $next)
|
|
|
|
{
|
|
|
|
$manager = LaravelGettext::getFacadeRoot();
|
|
|
|
|
|
|
|
$locale = env('APP_LOCALE', 'it_IT');
|
|
|
|
$manager->setLocale($locale);
|
2021-08-06 12:24:47 +02:00
|
|
|
app()->setLocale($locale);
|
2021-03-03 08:26:20 +01:00
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|