HasPageShield to mapper

This commit is contained in:
salam committed 2026-07-12 09:01:31 +02:00
1 parent ab628108cc
commit 7e000dce88
1 file changed
+13 -11
+13 -11
View File
@@ -4,6 +4,7 @@ namespace App\Filament\Pages;
use App\Models\User;
use BackedEnum;
use BezhanSalleh\FilamentShield\Traits\HasPageShield;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Notifications\Notification;
@@ -11,6 +12,8 @@ use Filament\Pages\Page;
class EventMapper extends Page
{
use HasPageShield;
protected $listeners = [
'refresh' => '$refresh',
];
@@ -33,7 +36,7 @@ class EventMapper extends Page
ActionGroup::make([
Action::make('bet365')
->extraAttributes(['x-on:click' => 'toggle'])
->visible(fn (): bool => auth()->user()->provider_id != 2)
->visible(fn(): bool => auth()->user()->provider_id != 2)
->action(function ($livewire) {
User::where('id', auth()->user()->id)->update(['provider_id' => 2]);
@@ -46,8 +49,8 @@ class EventMapper extends Page
Action::make('magloo_nigeria')
->label('MAGLOO NIGERIA')
->extraAttributes(['x-on:click' => 'toggle'])
->visible(fn (): bool => in_array(auth()->user()->provider_id, [2, 4]))
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16]))
->visible(fn(): bool => in_array(auth()->user()->provider_id, [2, 4]))
->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16]))
->action(function ($livewire) {
User::where('id', auth()->user()->id)->update(['provider_id' => 3]);
$livewire->dispatch('refresh');
@@ -56,13 +59,12 @@ class EventMapper extends Page
->title('Event Mapper changed to MAGLOO NIGERIA')
->success()
->send();
}),
Action::make('magloo_kenia')
->label('MAGLOO KENIA')
->extraAttributes(['x-on:click' => 'toggle'])
->visible(fn (): bool => in_array(auth()->user()->provider_id, [2, 3]))
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16]))
->visible(fn(): bool => in_array(auth()->user()->provider_id, [2, 3]))
->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [10, 16]))
->action(function ($livewire) {
User::where('id', auth()->user()->id)->update(['provider_id' => 4]);
$livewire->dispatch('refresh');
@@ -75,8 +77,8 @@ class EventMapper extends Page
Action::make('logifuture_nigeria')
->label('LOGIFUTURE NIGERA')
->extraAttributes(['x-on:click' => 'toggle'])
->visible(fn (): bool => auth()->user()->provider_id == 6)
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36]))
->visible(fn(): bool => auth()->user()->provider_id == 6)
->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36]))
->action(function ($livewire) {
User::where('id', auth()->user()->id)->update(['provider_id' => 5]);
@@ -90,8 +92,8 @@ class EventMapper extends Page
Action::make('logifuture_colombia')
->label('LOGIFUTURE COLOMBIA')
->extraAttributes(['x-on:click' => 'toggle'])
->visible(fn (): bool => auth()->user()->provider_id == 5)
->hidden(fn (): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36]))
->visible(fn(): bool => auth()->user()->provider_id == 5)
->hidden(fn(): bool => ! in_array(auth()->user()->bookmaker_id, [35, 36]))
->action(function ($livewire) {
User::where('id', auth()->user()->id)->update(['provider_id' => 6]);
@@ -105,7 +107,7 @@ class EventMapper extends Page
])
->label('Swop Bookmaker')
->icon('phosphor-dots-three-vertical')
->visible(fn (): bool => auth()->user()->hasRole('mapper_source_betsapi'))
->visible(fn(): bool => auth()->user()->hasRole('mapper_source_betsapi'))
->color('primary')
->button(),
];