Fixed error ERROR: SQLSTATE[42S22]

This commit is contained in:
Julian Prieber 2023-07-22 13:32:20 +02:00
parent c5970309b4
commit 613e802f2f
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use App\Models\User;
@ -11,6 +12,7 @@ class Impersonate
{
public function handle($request, Closure $next)
{
if(Schema::hasColumn('users', 'auth_as')) {
$adminUser = User::where('role', 'admin')->where(function ($query) {
$query->where('auth_as', '!=', null)
->where('auth_as', '!=', '');
@ -156,5 +158,10 @@ EOD;
} else {
return $next($request);
}
} else {
return $next($request);
}
}
}