<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\App;

class Localization {
    public function handle(Request $request, Closure $next) {
        if ($locale = $request->header('Locale')) {
            App::setLocale($locale);
            Carbon::setLocale($locale);
        }
        return $next($request);
    }
}