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,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Sport;
|
||||
use App\Models\User;
|
||||
use Livewire\Component;
|
||||
|
||||
class SportSwitcher extends Component
|
||||
{
|
||||
public $sports = [];
|
||||
|
||||
public $sport_id = 0;
|
||||
|
||||
public $sporticon = '';
|
||||
|
||||
public $iconcolor = '';
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$cps = Client::where('id', auth()->user()->client_id)->pluck('sport')->first();
|
||||
|
||||
$this->sports = Sport::whereIn('id', $cps)->pluck('name', 'id');
|
||||
|
||||
$this->sporticon = Sport::where('id', auth()->user()->sport_id)->pluck('icon')->first();
|
||||
|
||||
$this->iconcolor = Sport::where('id', auth()->user()->sport_id)->pluck('color')->first();
|
||||
|
||||
$this->sport_id = auth()->user()->sport_id;
|
||||
|
||||
}
|
||||
|
||||
public function swopSport()
|
||||
{
|
||||
User::where('id', auth()->user()->id)->update(['sport_id' => $this->sport_id]);
|
||||
|
||||
$this->dispatch('clear_filters');
|
||||
|
||||
$this->js('window.location.reload()');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.sport-switcher');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user