fix: use Auth(), add new db proxy stop event refactor clickhouse view
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
namespace App\Livewire\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Container\Attributes\Auth as AttributesAuth;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Livewire\Component;
|
||||
|
||||
@@ -23,7 +25,7 @@ class Index extends Component
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
if (auth()->user()->id !== 0) {
|
||||
if (Auth::id() !== 0) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->getSubscribers();
|
||||
@@ -51,13 +53,13 @@ class Index extends Component
|
||||
|
||||
public function switchUser(int $user_id)
|
||||
{
|
||||
if (auth()->user()->id !== 0) {
|
||||
if (AttributesAuth::id() !== 0) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$user = User::find($user_id);
|
||||
$team_to_switch_to = $user->teams->first();
|
||||
Cache::forget("team:{$user->id}");
|
||||
auth()->login($user);
|
||||
Auth::login($user);
|
||||
refreshSession($team_to_switch_to);
|
||||
|
||||
return redirect(request()->header('Referer'));
|
||||
|
||||
Reference in New Issue
Block a user