chore: run php-cs-fixer
This commit is contained in:
parent
3d7112b702
commit
f45eac623c
2 changed files with 0 additions and 68 deletions
|
@ -33,7 +33,6 @@ use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
|
|||
use Pterodactyl\Http\Middleware\Api\Client\SubstituteClientBindings;
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateApplicationUser;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\SubstituteApplicationApiBindings;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
|
@ -71,7 +70,6 @@ class Kernel extends HttpKernel
|
|||
AuthenticateIPAccess::class,
|
||||
],
|
||||
'application-api' => [
|
||||
// SubstituteApplicationApiBindings::class,
|
||||
SubstituteBindings::class,
|
||||
AuthenticateApplicationUser::class,
|
||||
],
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Middleware\Api\Application;
|
||||
|
||||
use Closure;
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Illuminate\Contracts\Routing\Registrar;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
|
||||
class SubstituteApplicationApiBindings
|
||||
{
|
||||
protected Registrar $router;
|
||||
|
||||
/**
|
||||
* Mappings to automatically assign route parameters to a model.
|
||||
*/
|
||||
protected static array $mappings = [
|
||||
'allocation' => Allocation::class,
|
||||
'database' => Database::class,
|
||||
'egg' => Egg::class,
|
||||
'location' => Location::class,
|
||||
'nest' => Nest::class,
|
||||
'node' => Node::class,
|
||||
'server' => Server::class,
|
||||
'user' => User::class,
|
||||
];
|
||||
|
||||
public function __construct(Registrar $router)
|
||||
{
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform substitution of route parameters without triggering
|
||||
* a 404 error if a model is not found.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
foreach (self::$mappings as $key => $class) {
|
||||
$this->router->bind($key, $class);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->router->substituteImplicitBindings($route = $request->route());
|
||||
} catch (ModelNotFoundException $exception) {
|
||||
if (!empty($route) && $route->getMissing()) {
|
||||
$route->getMissing()($request);
|
||||
}
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue