wip filter
This commit is contained in:
1 parent
c4d7f2e6ee
commit
d2caac4bcc
20 files changed
+567
-119
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<?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);
|
||||
|
||||
User::where('id', auth()->user()->id)->update(['sport_id' => 1, 'provider_id' => $provider_id, 'bookmaker_id' => $bookmaker_id, 'client_id' => $client_id]);
|
||||
|
||||
$this->js('window.location.reload()');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.konto-switcher');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user