1489f7a694
PufferPanel v0.9 (Laravel) is now Pterodactyl 1.0
33 lines
594 B
PHP
33 lines
594 B
PHP
<?php
|
|
|
|
namespace Pterodactyl\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Auth;
|
|
use Pterodactyl\Models\Server;
|
|
use Debugbar;
|
|
|
|
class CheckServer
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
|
|
if (!Auth::user()) {
|
|
return redirect()->guest('auth/login');
|
|
}
|
|
|
|
if (!Server::getByUUID($request->route()->server)) {
|
|
return redirect('/');
|
|
}
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
}
|