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