diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f076b44..bb78109 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -345,6 +345,11 @@ parameters: count: 1 path: src/Http/Middleware/CheckLocation.php + - + message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:getUser\\(\\)\\.$#" + count: 1 + path: src/Http/Middleware/CheckLocation.php + - message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:user\\(\\)\\.$#" count: 1 @@ -355,6 +360,11 @@ parameters: count: 1 path: src/Http/Middleware/CheckLocation.php + - + message: "#^Cannot call method parameter\\(\\) on object\\|string\\.$#" + count: 1 + path: src/Http/Middleware/CheckLocation.php + - message: "#^Cannot call method setParameter\\(\\) on object\\|string\\.$#" count: 1 diff --git a/src/Http/Middleware/CheckLocation.php b/src/Http/Middleware/CheckLocation.php index 86725e1..53dd6fb 100644 --- a/src/Http/Middleware/CheckLocation.php +++ b/src/Http/Middleware/CheckLocation.php @@ -29,7 +29,7 @@ public function handle(Request $request, Closure $next) $request->route()->setParameter('location', $location->permalink_slug); } - if ($request->route()->parameter('location') !== Location::current()->permalink_slug) { + if ($location && $request->route()->parameter('location') !== $location?->permalink_slug) { return redirect()->to(page_url('home')); }