mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Remove reference to guard from binder
This commit is contained in:
parent
55f13ef121
commit
14772469ed
@ -25,7 +25,6 @@ namespace FireflyIII\Http\Middleware;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use FireflyIII\Support\Domain;
|
use FireflyIII\Support\Domain;
|
||||||
use Illuminate\Contracts\Auth\Factory as Auth;
|
use Illuminate\Contracts\Auth\Factory as Auth;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Routing\Route;
|
use Illuminate\Routing\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,16 +67,9 @@ class Binder
|
|||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next, ...$guards)
|
public function handle($request, Closure $next, ...$guards)
|
||||||
{
|
{
|
||||||
$middleware = $request->route()->middleware();
|
|
||||||
$guard = 'web';
|
|
||||||
if(in_array('auth:api', $middleware)) {
|
|
||||||
$guard = 'api';
|
|
||||||
}
|
|
||||||
$guard = auth()->guard($guard);
|
|
||||||
|
|
||||||
foreach ($request->route()->parameters() as $key => $value) {
|
foreach ($request->route()->parameters() as $key => $value) {
|
||||||
if (isset($this->binders[$key])) {
|
if (isset($this->binders[$key])) {
|
||||||
$boundObject = $this->performBinding($guard, $key, $value, $request->route());
|
$boundObject = $this->performBinding($key, $value, $request->route());
|
||||||
$request->route()->setParameter($key, $boundObject);
|
$request->route()->setParameter($key, $boundObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,9 +84,10 @@ class Binder
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function performBinding($guard, string $key, string $value, Route $route)
|
private function performBinding(string $key, string $value, Route $route)
|
||||||
{
|
{
|
||||||
$class = $this->binders[$key];
|
$class = $this->binders[$key];
|
||||||
return $class::routeBinder($guard, $value, $route);
|
|
||||||
|
return $class::routeBinder($value, $route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user