swop bookmaker and bookmaker mapper

This commit is contained in:
salam committed 2025-12-30 18:03:46 +01:00
1 parent 17acb27ef0
commit 7f7fc5c98f
10 files changed
+342 -67

No files matched your search

+19 -1
View File
@@ -24,6 +24,10 @@ class TopMenuItems extends Component
public $current = '';
protected $listeners = [
'reload_data' => '$refresh',
];
public function mount()
{
$cps = Client::where('id', auth()->user()->client_id)->pluck('sport')->first();
@@ -54,11 +58,25 @@ class TopMenuItems extends Component
$bookmaker_id = array_shift($bookmakers);
User::where('id', auth()->user()->id)->update(['bookmaker_id' => $bookmaker_id, 'client_id' => $client_id]);
User::where('id', auth()->user()->id)->update(['bookmaker_mapper_id' => $bookmaker_id, 'bookmaker_id' => $bookmaker_id, 'client_id' => $client_id]);
$this->js('window.location.reload()');
}
public function swopBookmaker($bookmaker_id)
{
User::where('id', auth()->user()->id)->update(['bookmaker_id' => $bookmaker_id]);
$this->js('window.location.reload()');
}
public function swopMapper($bookmaker_id)
{
User::where('id', auth()->user()->id)->update(['bookmaker_mapper_id' => $bookmaker_id]);
$this->dispatch('reload_data');
}
public function swopSport()
{
User::where('id', auth()->user()->id)->update(['sport_id' => $this->sport_id]);
+12 -5
View File
@@ -20,10 +20,6 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, HasRoles, Notifiable;
protected $casts = [
'bettype_status' => 'json',
];
/**
* The attributes that are mass assignable.
*
@@ -36,10 +32,10 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
'password',
'agb_akzeptiert',
'app_verified_at',
'bettype_status',
'client_id',
'sport_id',
'bookmaker_id',
'bookmaker_mapper_id',
];
protected static function newFactory(): Factory
@@ -164,4 +160,15 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
{
return $this->hasMany(BettypeUser::class)->where('sport_id', auth()->user()->sport_id);
}
// Accessor
public function getUserBookmakerAttribute()
{
return $this->userBookmaker()->id ?? null;
}
public function userBookmaker()
{
return Bookmaker::where('id', auth()->user()->bookmaker_id)->select('id', 'name', 'icon', 'svg', 'txid')->first();
}
}