33 lines
830 B
PHP
33 lines
830 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\Facades\Redirect;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\Facades\Lang;
|
|
use Illuminate\Support\Facades\Session;
|
|
|
|
use Illuminate\Support\Facades\App;
|
|
|
|
|
|
class SetLocale
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
|
*/
|
|
public function handle(Request $request, Closure $next): Response
|
|
{
|
|
$locale = Session::get('locale', 'np'); // default to Nepali
|
|
App::setLocale($locale);
|
|
return $next($request);
|
|
}
|
|
}
|