fix: use Auth(), add new db proxy stop event refactor clickhouse view

This commit is contained in:
Andras Bacsai
2024-11-04 14:18:16 +01:00
parent 1ab459a09b
commit 7fb1a1fc75
22 changed files with 236 additions and 123 deletions

View File

@@ -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'));