basic license wip
This commit is contained in:
30
app/Http/Middleware/LicenseValid.php
Normal file
30
app/Http/Middleware/LicenseValid.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class LicenseValid
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (!config('coolify.self_hosted')) {
|
||||
$value = Cache::get('license_key');
|
||||
if (!$value) {
|
||||
ray($request->path());
|
||||
if ($request->path() !== 'license' && $request->path() !== 'livewire/message/license') {
|
||||
return redirect('license');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user