From 166261ae31fb5d31be0e2cec041added20c9f994 Mon Sep 17 00:00:00 2001 From: Julian Prieber <60265788+JulianPrieber@users.noreply.github.com> Date: Thu, 13 Jul 2023 18:56:23 +0200 Subject: [PATCH] Update Impersonate.php --- app/Http/Middleware/Impersonate.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Middleware/Impersonate.php b/app/Http/Middleware/Impersonate.php index 9c7601a..321b603 100644 --- a/app/Http/Middleware/Impersonate.php +++ b/app/Http/Middleware/Impersonate.php @@ -10,7 +10,10 @@ class Impersonate { public function handle($request, Closure $next) { - $adminUser = User::whereNotNull('auth_as')->where('role', 'admin')->first(); + $adminUser = User::where('role', 'admin')->where(function ($query) { + $query->where('auth_as', '!=', null) + ->where('auth_as', '!=', ''); + })->first(); if ($adminUser) {