37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\MultilineClients\Schemas;
|
|
|
|
use App\Models\Bettype;
|
|
use App\Models\Bookmaker;
|
|
use App\Models\Matchpart;
|
|
use App\Models\Sport;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Schemas\Components\Utilities\Get;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class MultilineClientForm
|
|
{
|
|
public static $bettypes = [1, 2, 3, 4, 16, 2001, 2002, 2021, 3001, 3002, 3021];
|
|
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Select::make('sport_id')
|
|
->live()
|
|
->options(Sport::where('is_active', 1)->pluck('name', 'id'))
|
|
->preload(),
|
|
Select::make('matchpart_id')
|
|
->options(Matchpart::where('is_active', 1)->pluck('name', 'id'))
|
|
->preload(),
|
|
Select::make('bettype_id')
|
|
->options(fn (Get $get) => Bettype::where('sport_id', $get('sport_id'))->whereIn('bettype_id', self::$bettypes)->pluck('name', 'bettype_id')),
|
|
Select::make('bookmaker_id')
|
|
->options(Bookmaker::where('is_active', 1)->pluck('name', 'txid'))
|
|
->preload()
|
|
->searchable(),
|
|
]);
|
|
}
|
|
}
|