mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 07:34:45 +02:00
This has to match up with the parent
This commit is contained in:
parent
7df31a1eeb
commit
add838d42f
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware\Api\Client;
|
namespace App\Http\Middleware\Api\Client;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use Closure;
|
||||||
use Illuminate\Contracts\Routing\Registrar;
|
use Illuminate\Contracts\Routing\Registrar;
|
||||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||||
|
|
||||||
@ -14,10 +14,9 @@ class SubstituteClientBindings extends SubstituteBindings
|
|||||||
parent::__construct($router);
|
parent::__construct($router);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Request $request, \Closure $next): mixed
|
public function handle($request, Closure $next): mixed
|
||||||
{
|
{
|
||||||
// Override default behavior of the model binding to use a specific table
|
// Override default behavior of the model binding to use a specific table column rather than the default 'id'.
|
||||||
// column rather than the default 'id'.
|
|
||||||
$this->router->bind('server', function ($value) {
|
$this->router->bind('server', function ($value) {
|
||||||
return $this->server->query()->where(strlen($value) === 8 ? 'uuidShort' : 'uuid', $value)->firstOrFail();
|
return $this->server->query()->where(strlen($value) === 8 ? 'uuidShort' : 'uuid', $value)->firstOrFail();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user