fix sport select
This commit is contained in:
1 parent
82e6a60253
commit
e923508630
1 file changed
+6
-7
@@ -33,7 +33,6 @@ use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
@@ -216,8 +215,8 @@ class EventsTable
|
||||
->multiple()
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function (Get $get) {
|
||||
$res = Event::where('sport_id', $get('sport_id'))->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
->options(function () {
|
||||
$res = Event::where('sport_id', self::$user->sport_id)->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
|
||||
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
|
||||
})
|
||||
@@ -235,9 +234,9 @@ class EventsTable
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
$res = Event::where('sport_id', $get('sport_id'))->with('country')->with('competition_group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
$res = Event::where('sport_id', self::$user->sport_id)->with('country')->with('competition_group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
} else {
|
||||
$res = Event::where('sport_id', $get('sport_id'))->with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
$res = Event::where('sport_id', self::$user->sport_id)->with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
}
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
@@ -257,9 +256,9 @@ class EventsTable
|
||||
->searchable()
|
||||
->options(function (Get $get) {
|
||||
if ($get('country_id')) {
|
||||
$res = Event::with('country')->where('sport_id', $get('sport_id'))->with('group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
$res = Event::with('country')->where('sport_id', self::$user->sport_id)->with('group')->where('country_id', $get('country_id'))->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
} else {
|
||||
$res = Event::with('country')->where('sport_id', $get('sport_id'))->with('group')->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
$res = Event::with('country')->where('sport_id', self::$user->sport_id)->with('group')->where('starttime', '>', Carbon::now())->groupBy('group_id')->get();
|
||||
}
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
|
||||
Reference in new issue
Block a user