provider, clients migration & resource
This commit is contained in:
1 parent
ab44b05fa3
commit
cbe68f78be
56 files changed
+721
-289
No files matched your search
@@ -3,8 +3,6 @@
|
||||
namespace App\Filament\Resources\Clients;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Clients\Pages\CreateClient;
|
||||
use App\Filament\Resources\Clients\Pages\EditClient;
|
||||
use App\Filament\Resources\Clients\Pages\ListClients;
|
||||
use App\Filament\Resources\Clients\Schemas\ClientForm;
|
||||
use App\Filament\Resources\Clients\Tables\ClientsTable;
|
||||
@@ -37,19 +35,10 @@ class ClientResource extends Resource
|
||||
return ClientsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListClients::route('/'),
|
||||
'create' => CreateClient::route('/create'),
|
||||
'edit' => EditClient::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Clients\RelationManagers;
|
||||
|
||||
use App\Filament\Resources\Clients\ClientResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BookmakerRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'bookmaker';
|
||||
|
||||
protected static ?string $relatedResource = ClientResource::class;
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->headerActions([
|
||||
CreateAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Filament\Resources\Clients\Schemas;
|
||||
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
@@ -13,10 +16,18 @@ class ClientForm
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->default(null),
|
||||
TextInput::make('homepage')
|
||||
->default(null),
|
||||
Select::make('bookmaker')
|
||||
->options(Bookmaker::query()->pluck('name', 'id'))
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
Select::make('sport')
|
||||
->options(Sport::query()->pluck('name', 'id'))
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Clients\Tables;
|
||||
|
||||
use App\Models\Bookmaker;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
@@ -14,12 +16,14 @@ class ClientsTable
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->searchable(),
|
||||
TextColumn::make('homepage')
|
||||
->searchable(),
|
||||
TextColumn::make('name'),
|
||||
TextColumn::make('bookmaker')
|
||||
->badge()
|
||||
->formatStateUsing(fn (string $state): string => Bookmaker::where('id', $state)->pluck('name')->first()),
|
||||
TextColumn::make('sport')
|
||||
->badge()
|
||||
->color('secondary')
|
||||
->formatStateUsing(fn (string $state): string => Sport::where('id', $state)->pluck('name')->first()),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
@@ -29,9 +33,6 @@ class ClientsTable
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
|
||||
Reference in new issue
Block a user