remove tabulator-tables design event table grid
This commit is contained in:
1 parent
a597d3161b
commit
12b27a52dc
46 files changed
+17584
-437
No files matched your search
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\DB;
|
||||
|
||||
class DbOdds
|
||||
{
|
||||
public static function call() {}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Helper;
|
||||
use App\Console\Commands\NuhBash;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Utilities\Notice;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Clusters\Cluster;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class MaintenanceCluster extends Cluster
|
||||
{
|
||||
protected static string | \BackedEnum | null $navigationIcon = Heroicon::OutlinedSquares2x2;
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class EventForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
// `starttime` datetime DEFAULT NULL,
|
||||
// `sport_id` int(11) NOT NULL,
|
||||
// `provider_id` int(11) DEFAULT 0,
|
||||
// `txodds_id` int(11) DEFAULT 0,
|
||||
// `betaid_id` int(11) DEFAULT 0,
|
||||
// `betradar_id` int(11) DEFAULT 0,
|
||||
// `magnig_id` int(11) DEFAULT 0,
|
||||
// `magken_id` int(11) DEFAULT 0,
|
||||
// `lognig_id` int(11) DEFAULT 0,
|
||||
// `logcol_id` int(11) DEFAULT 0,
|
||||
// `liga_id` int(11) DEFAULT 0,
|
||||
// `home_id` int(11) DEFAULT 0,
|
||||
// `away_id` int(11) DEFAULT 0,
|
||||
return $schema
|
||||
->components([
|
||||
DateTimePicker::make('starttime')
|
||||
->aboveContent(['UTC time +1h']),
|
||||
TextInput::make('sport_id')
|
||||
->required()
|
||||
->numeric()
|
||||
->aboveContent(fn ($record): string => $record->sport->name),
|
||||
TextInput::make('liga_id')
|
||||
->numeric()
|
||||
->default(0)
|
||||
->aboveContent(fn ($record): string => $record->liga->name),
|
||||
TextInput::make('home_id')
|
||||
->required()
|
||||
->aboveContent(fn ($record): string => $record->home->name),
|
||||
TextInput::make('away_id')
|
||||
->required()
|
||||
->aboveContent(fn ($record): string => $record->away->name),
|
||||
TextInput::make('provider_id')
|
||||
->aboveContent(['1 TXOdds', '2 BetsApi', '3 Direct'])
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('txodds_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('betaid_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('betradar_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('magnig_id')
|
||||
->label('Magloo Nigeria Id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('magken_id')
|
||||
->label('Magloo Kenia Id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('lognig_id')
|
||||
->label('Logifuture Nigeria Id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('logcol_id')
|
||||
->label('Logifuture Colombia Id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Tables;
|
||||
|
||||
use App\Models\Liga;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class EventsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('sport_id')
|
||||
->label('')
|
||||
->icon(function ($record): string {
|
||||
return $record->sport->icon;
|
||||
}),
|
||||
|
||||
TextColumn::make('txodds_id')->copyable(),
|
||||
TextColumn::make('starttime')->dateTime('M j, Y H:i')->sortable(),
|
||||
IconColumn::make('country_id')
|
||||
->label('Flag')
|
||||
->icon(function ($record): string {
|
||||
return $record->country->icon;
|
||||
}),
|
||||
TextColumn::make('country.name'),
|
||||
TextColumn::make('liga.name'),
|
||||
TextColumn::make('home.name')->searchable(),
|
||||
TextColumn::make('away.name')->searchable(),
|
||||
// TextColumn::make('prid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('txid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('brid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('baid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('cnid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('grid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('cgid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('hoid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('awid')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
// TextColumn::make('liga')
|
||||
// ->searchable(),
|
||||
|
||||
// TextColumn::make('away')
|
||||
// ->searchable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Models\Comparatore;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Enums\Width;
|
||||
use UnitEnum;
|
||||
|
||||
class Monitor extends Page
|
||||
{
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'phosphor-monitor';
|
||||
|
||||
protected string $view = 'filament.pages.monitor';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Monitor';
|
||||
|
||||
protected static ?string $pluralLabel = 'Monitor';
|
||||
|
||||
protected ?string $heading = '';
|
||||
|
||||
protected static ?string $title = '';
|
||||
|
||||
public $data = [];
|
||||
|
||||
// protected array $extraBodyAttributes = ['class' => 'border border-red-500'];
|
||||
|
||||
// public function getMaxContentWidth(): Width
|
||||
// {
|
||||
// return Width::Full;
|
||||
// }
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$tmp = Comparatore::limit(100)->get();
|
||||
$data = [];
|
||||
foreach ($tmp as $value) {
|
||||
$data[] = json_decode($value['fdata'], 1);
|
||||
}
|
||||
$this->data = json_encode($data);
|
||||
}
|
||||
|
||||
// protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
// public function onboardingAction(): Action
|
||||
// {
|
||||
// return Action::make('onboarding')
|
||||
// ->modalHeading('Welcome');
|
||||
// }
|
||||
|
||||
// protected function getHeaderActions(): array
|
||||
// {
|
||||
// return [
|
||||
// Action::make('edit')->modalHeading('Welcome'),
|
||||
// // ->url(route('posts.edit', ['post' => $this->post])),
|
||||
// Action::make('delete'),
|
||||
// // ->requiresConfirmation()
|
||||
// // ->action(fn () => $this->post->delete()),
|
||||
// ];
|
||||
// }
|
||||
}
|
||||
@@ -2,17 +2,14 @@
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Bookmakers\Pages\ListBookmakers;
|
||||
use App\Filament\Resources\Bookmakers\Schemas\BookmakerForm;
|
||||
use App\Filament\Resources\Bookmakers\Tables\BookmakersTable;
|
||||
use App\Models\Bookmaker;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use UnitEnum;
|
||||
|
||||
class BookmakerResource extends Resource
|
||||
{
|
||||
@@ -20,11 +17,9 @@ class BookmakerResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 21;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-notebook-pen';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-notebook-pen';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources\Clients;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Clients\Pages\ListClients;
|
||||
use App\Filament\Resources\Clients\Schemas\ClientForm;
|
||||
use App\Filament\Resources\Clients\Tables\ClientsTable;
|
||||
use App\Models\Client;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class ClientResource extends Resource
|
||||
{
|
||||
@@ -19,11 +16,9 @@ class ClientResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 32;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-square-user';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-square-user';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'User Management';
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'User';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Countries;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Countries\Pages\ManageCountries;
|
||||
use App\Models\Country;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
@@ -18,7 +16,6 @@ use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use UnitEnum;
|
||||
|
||||
class CountryResource extends Resource
|
||||
{
|
||||
@@ -26,13 +23,11 @@ class CountryResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 22;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-flag';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-flag';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
+15
-11
@@ -1,29 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events;
|
||||
namespace App\Filament\Resources\Events;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Pages\ListEvents;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Schemas\EventForm;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Tables\EventsTable;
|
||||
use App\Filament\Resources\Events\Pages\ListEvents;
|
||||
use App\Filament\Resources\Events\Schemas\EventForm;
|
||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\Event;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class EventResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Event::class;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-monitor';
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-goal';
|
||||
protected static ?string $navigationLabel = 'Monitor';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
protected static ?string $modelLabel = 'Monitor';
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Data';
|
||||
protected static ?string $title = 'Monitor';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Monitor';
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Pages;
|
||||
namespace App\Filament\Resources\Events\Pages;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\EventResource;
|
||||
use App\Filament\Resources\Events\EventResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateEvent extends CreateRecord
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Pages;
|
||||
namespace App\Filament\Resources\Events\Pages;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\EventResource;
|
||||
use App\Filament\Resources\Events\EventResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Pages;
|
||||
namespace App\Filament\Resources\Events\Pages;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\EventResource;
|
||||
use App\Filament\Resources\Events\EventResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
@@ -13,7 +13,7 @@ class ListEvents extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
// CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class EventForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
DateTimePicker::make('starttime'),
|
||||
TextInput::make('sport_id')
|
||||
->required()
|
||||
->numeric(),
|
||||
TextInput::make('country_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('liga_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('home_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('away_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('provider_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('txodds_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('betaid_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('betradar_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('magnig_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('magken_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('lognig_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('logcol_id')
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Events\Tables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class EventsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
->label('')
|
||||
->size(IconSize::ExtraLarge)
|
||||
->icon(fn ($record) => $record->sport->icon)
|
||||
->extraAttributes(fn ($record): array => [
|
||||
'x-tooltip.html' => new HtmlString,
|
||||
'x-tooltip.raw' => new HtmlString('Betradar: '.$record->betaid_id.'<br>TxOdds: '.$record->txodds_id),
|
||||
]),
|
||||
TextColumn::make('starttime')
|
||||
->label('Start')
|
||||
->alignCenter()
|
||||
->dateTime('d.m')
|
||||
->weight(FontWeight::Bold)
|
||||
->description(fn ($state): string => Carbon::createFromDate($state)->format('H:i')),
|
||||
TextColumn::make('liga.name')
|
||||
->color('gray')
|
||||
->label('Event')
|
||||
->icon(fn ($record) => $record->country->icon)
|
||||
->description(fn ($record) => $record->home->name.' - '.$record->away->name, position: 'belowe'),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime('d.m H:i'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
// EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources\Providers;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Providers\Pages\ListProviders;
|
||||
use App\Filament\Resources\Providers\Schemas\ProviderForm;
|
||||
use App\Filament\Resources\Providers\Tables\ProvidersTable;
|
||||
use App\Models\Provider;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class ProviderResource extends Resource
|
||||
{
|
||||
@@ -19,13 +16,11 @@ class ProviderResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 23;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-arrow-down-up';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-arrow-down-up';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Sports;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Sports\Pages\ManageSports;
|
||||
use App\Models\Sport;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
@@ -14,7 +12,6 @@ use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class SportResource extends Resource
|
||||
{
|
||||
@@ -22,13 +19,11 @@ class SportResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 24;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-volleyball';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-volleyball';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -2,28 +2,23 @@
|
||||
|
||||
namespace App\Filament\Resources\Supervisors;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Supervisors\Pages\ListSupervisors;
|
||||
use App\Filament\Resources\Supervisors\Schemas\SupervisorForm;
|
||||
use App\Filament\Resources\Supervisors\Tables\SupervisorsTable;
|
||||
use App\Models\Supervisor;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class SupervisorResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Supervisor::class;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-sliders-vertical';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-sliders-vertical';
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources\Users;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Users\Pages\ListUsers;
|
||||
use App\Filament\Resources\Users\Schemas\UserForm;
|
||||
use App\Filament\Resources\Users\Tables\UsersTable;
|
||||
use App\Models\User;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
@@ -19,13 +16,11 @@ class UserResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 31;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-user';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'lucide-user';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'User Management';
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'User';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ class Event extends Model
|
||||
|
||||
public function sport()
|
||||
{
|
||||
return $this->belongsTo(Sport::class);
|
||||
return $this->belongsTo(Sport::class, 'sport_id', 'id');
|
||||
}
|
||||
|
||||
public function country()
|
||||
|
||||
+94
-5
@@ -2,16 +2,22 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
|
||||
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
|
||||
use Filament\Auth\MultiFactor\Email\Contracts\HasEmailAuthentication;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
class User extends Authenticatable implements FilamentUser, HasAppAuthentication, HasAppAuthenticationRecovery, HasEmailAuthentication, MustVerifyEmail
|
||||
{
|
||||
/** @use HasFactory<UserFactory> */
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, HasRoles, Notifiable;
|
||||
|
||||
/**
|
||||
@@ -20,11 +26,19 @@ class User extends Authenticatable
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'gender',
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'agb_akzeptiert',
|
||||
'app_verified_at',
|
||||
];
|
||||
|
||||
protected static function newFactory(): Factory
|
||||
{
|
||||
return UserFactory::new();
|
||||
}
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
@@ -33,6 +47,8 @@ class User extends Authenticatable
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
'app_authentication_secret',
|
||||
'app_authentication_recovery_codes',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -45,11 +61,84 @@ class User extends Authenticatable
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'app_verified_at' => 'datetime',
|
||||
'app_authentication_secret' => 'encrypted',
|
||||
'app_authentication_recovery_codes' => 'encrypted:array',
|
||||
'has_email_authentication' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function client()
|
||||
public function getAppAuthenticationSecret(): ?string
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
// This method should return the user's saved app authentication secret.
|
||||
|
||||
return $this->app_authentication_secret;
|
||||
}
|
||||
|
||||
public function saveAppAuthenticationSecret(?string $secret): void
|
||||
{
|
||||
// This method should save the user's app authentication secret.
|
||||
|
||||
$this->app_authentication_secret = $secret;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function getAppAuthenticationHolderName(): string
|
||||
{
|
||||
// In a user's authentication app, each account can be represented by a "holder name".
|
||||
// If the user has multiple accounts in your app, it might be a good idea to use
|
||||
// their email address as then they are still uniquely identifiable.
|
||||
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?array<string>
|
||||
*/
|
||||
public function getAppAuthenticationRecoveryCodes(): ?array
|
||||
{
|
||||
// This method should return the user's saved app authentication recovery codes.
|
||||
|
||||
return $this->app_authentication_recovery_codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string> | null $codes
|
||||
*/
|
||||
public function saveAppAuthenticationRecoveryCodes(?array $codes): void
|
||||
{
|
||||
// This method should save the user's app authentication recovery codes.
|
||||
|
||||
$this->app_authentication_recovery_codes = $codes;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function hasEmailAuthentication(): bool
|
||||
{
|
||||
// This method should return true if the user has enabled email authentication.
|
||||
|
||||
return $this->has_email_authentication;
|
||||
}
|
||||
|
||||
public function toggleEmailAuthentication(bool $condition): void
|
||||
{
|
||||
// This method should save whether or not the user has enabled email authentication.
|
||||
|
||||
$this->has_email_authentication = $condition;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function canAccessPanel(Panel $panel): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canAccessAdminPanel(Panel $panel): bool
|
||||
{
|
||||
if ($panel->getId() === 'admin') {
|
||||
return $this->hasVerifiedEmail();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+27
-65
@@ -1,108 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class RolePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('view_any_role');
|
||||
return $authUser->can('ViewAny:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Role $role): bool
|
||||
public function view(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $user->can('view_role');
|
||||
return $authUser->can('View:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_role');
|
||||
return $authUser->can('Create:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Role $role): bool
|
||||
public function update(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $user->can('update_role');
|
||||
return $authUser->can('Update:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Role $role): bool
|
||||
public function delete(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $user->can('delete_role');
|
||||
return $authUser->can('Delete:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $user->can('delete_any_role');
|
||||
return $authUser->can('Restore:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Role $role): bool
|
||||
public function forceDelete(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $user->can('{{ ForceDelete }}');
|
||||
return $authUser->can('ForceDelete:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently bulk delete.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('{{ ForceDeleteAny }}');
|
||||
return $authUser->can('ForceDeleteAny:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Role $role): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('{{ Restore }}');
|
||||
return $authUser->can('RestoreAny:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser, Role $role): bool
|
||||
{
|
||||
return $user->can('{{ RestoreAny }}');
|
||||
return $authUser->can('Replicate:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Role $role): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('{{ Replicate }}');
|
||||
return $authUser->can('Reorder:Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('{{ Reorder }}');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Filament\Support\Assets\Css;
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Facades\FilamentColor;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@@ -22,13 +22,16 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
FilamentAsset::register([
|
||||
Css::make('tabulator-light', __DIR__.'/../../node_modules/tabulator-tables/dist/css/tabulator_simple.min.css')
|
||||
->loadedOnRequest(),
|
||||
Css::make('tabulator-dark', __DIR__.'/../../resources/css/tabulator-dark.css')
|
||||
->loadedOnRequest(),
|
||||
Js::make('tabulator-js', __DIR__.'/../../node_modules/tabulator-tables/dist/js/tabulator_esm.min.mjs')
|
||||
->loadedOnRequest(),
|
||||
Carbon::setLocale(app()->getLocale());
|
||||
|
||||
FilamentColor::register([
|
||||
'danger' => Color::Red,
|
||||
'gray' => Color::Zinc,
|
||||
'primary' => Color::Red,
|
||||
'success' => Color::Green,
|
||||
'warning' => Color::Yellow,
|
||||
'info' => Color::Indigo,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@ use Awcodes\LightSwitch\Enums\Alignment;
|
||||
use Awcodes\LightSwitch\LightSwitchPlugin;
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
use Filament\Auth\MultiFactor\Email\EmailAuthentication;
|
||||
use Filament\Auth\Pages\PasswordReset\RequestPasswordReset;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
@@ -13,7 +16,6 @@ use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Pages\Dashboard;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Widgets\AccountWidget;
|
||||
use Filament\Widgets\FilamentInfoWidget;
|
||||
@@ -34,19 +36,27 @@ class AdminPanelProvider extends PanelProvider
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
return $panel
|
||||
->default()
|
||||
->id('admin')
|
||||
->path('')
|
||||
->login()
|
||||
->passwordReset()
|
||||
->brandLogo(asset('images/nuh-odds.svg'))
|
||||
->darkModeBrandLogo(asset('images/nuh-odds-d.svg'))
|
||||
->passwordReset(RequestPasswordReset::class)
|
||||
->emailVerification()
|
||||
->emailChangeVerification()
|
||||
->databaseNotifications()
|
||||
->profile(isSimple: false)
|
||||
->default()
|
||||
->brandLogo(asset('images/nuh-combined.svg'))
|
||||
// ->darkModeBrandLogo(asset('images/nuh-odds-d.svg'))
|
||||
->favicon(asset('images/nuh.svg'))
|
||||
->brandLogoHeight('1.8rem')
|
||||
->unsavedChangesAlerts()
|
||||
->colors([
|
||||
'primary' => Color::Blue,
|
||||
->topNavigation()
|
||||
->multiFactorAuthentication([
|
||||
EmailAuthentication::make(),
|
||||
AppAuthentication::make()
|
||||
->recoverable(),
|
||||
])
|
||||
// ], isRequired: true)
|
||||
->viteTheme('resources/css/filament/admin/theme.css')
|
||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
|
||||
@@ -82,7 +92,10 @@ class AdminPanelProvider extends PanelProvider
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
])->plugins([
|
||||
FilamentShieldPlugin::make(),
|
||||
FilamentShieldPlugin::make()
|
||||
->navigationSort(10)
|
||||
->navigationBadge('3')
|
||||
->globallySearchable(false),
|
||||
FilamentEditProfilePlugin::make()->shouldRegisterNavigation(false),
|
||||
LightSwitchPlugin::make()->position(Alignment::BottomCenter),
|
||||
FilamentBackgroundsPlugin::make()
|
||||
|
||||
Reference in new issue
Block a user