FleetCart/app/Http/Middleware/LicenseChecker.php

30 lines
568 B
PHP
Raw Normal View History

2023-12-03 14:07:47 +00:00
<?php
namespace FleetCart\Http\Middleware;
use Closure;
use FleetCart\License;
class LicenseChecker
{
private $license;
public function __construct(License $license)
{
$this->license = $license;
}
public function handle($request, Closure $next)
{
if ($this->license->shouldRecheck()) {
$this->license->recheck();
} else if ($this->license->shouldCreateLicense()) {
return redirect()->route('license.create');
}
return $next($request);
}
}