This commit is contained in:
salam committed 2026-10-04 15:25:03 +02:00
1 parent 9bcd4432c6
commit 6f92f9e1d5
1209 files changed
+220940

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Livewire;
use App\Models\Client;
use App\Models\User;
use Livewire\Component;
class KontoSwitcher extends Component
{
public $clients = [];
public function mount()
{
$this->clients = Client::where('id', '!=', auth()->user()->client_id)->pluck('name', 'id')->all();
}
public function swopClient($client_id)
{
$providers = Client::where('id', $client_id)->pluck('provider')->first();
$provider_id = array_shift($providers);
$bookmakers = Client::where('id', $client_id)->pluck('bookmaker')->first();
$bookmaker_id = array_shift($bookmakers);
$partner_bookmaker_id = array_shift($bookmakers) ?? 0;
User::where('id', auth()->user()->id)->update([
'sport_id' => 1,
'provider_id' => $provider_id,
'bookmaker_id' => $bookmaker_id,
'partner_bookmaker_id' => $partner_bookmaker_id,
'client_id' => $client_id,
]);
$this->js('window.location.reload()');
}
public function render()
{
return view('livewire.konto-switcher');
}
}