. */ declare(strict_types=1); namespace FireflyIII\Http\Middleware; use Closure; use FireflyIII\Exceptions\FireflyException; use Log; use Ramsey\Uuid\Uuid; /** * * Class InstallationId */ class InstallationId { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param Closure $next * * @return mixed * * @throws FireflyException * */ public function handle($request, Closure $next) { $config = app('fireflyconfig')->get('installation_id', null); if (null === $config) { $uuid5 = Uuid::uuid5(Uuid::NAMESPACE_URL, 'firefly-iii.org'); $uniqueId = (string)$uuid5; Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId)); app('fireflyconfig')->set('installation_id', $uniqueId); } return $next($request); } }