add sorting to bettype toggle
This commit is contained in:
1 parent
e2886e0869
commit
3a7a0e02f3
9 files changed
+33
-35
No files matched your search
@@ -22,15 +22,15 @@ class SettingGeneratorUser
|
|||||||
* 3) BETTYPES for USER in MONITOR
|
* 3) BETTYPES for USER in MONITOR
|
||||||
**************************************************/
|
**************************************************/
|
||||||
|
|
||||||
$multilines = MultilineSetting::orderBy('sport_id')->pluck('sport_id', 'id');
|
$multilines = MultilineSetting::orderBy('sport_id')->get();
|
||||||
|
|
||||||
foreach ($multilines as $multiline_setting_id => $sport_id) {
|
foreach ($multilines as $multilines) {
|
||||||
|
|
||||||
$is_active = in_array($multiline_setting_id, [1, 2, 9, 10, 16, 17, 22, 23]) ? 1 : 0;
|
$is_active = in_array($multiline->id, [1, 2, 9, 10, 16, 17, 22, 23]) ? 1 : 0;
|
||||||
|
|
||||||
BettypeUser::firstOrCreate(
|
BettypeUser::firstOrCreate(
|
||||||
['sport_id' => $sport_id, 'user_id' => $record->id, 'multiline_setting_id' => $multiline_setting_id],
|
['sport_id' => $multiline->sport_id, 'user_id' => $record->id, 'multiline_setting_id' => $multiline->id],
|
||||||
['is_active' => $is_active],
|
['is_active' => $multiline->is_active, 'sorting' => $multiline->sorting],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,15 +103,15 @@ class GenerateSetting
|
|||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
|
|
||||||
$multilines = MultilineSetting::orderBy('sport_id')->pluck('sport_id', 'id');
|
$multilines = MultilineSetting::orderBy('sport_id')->get();
|
||||||
|
|
||||||
foreach ($multilines as $multiline_setting_id => $sport_id) {
|
foreach ($multilines as $multilines) {
|
||||||
|
|
||||||
$is_active = in_array($multiline_setting_id, [1, 2, 9, 10, 16, 17, 22, 23]) ? 1 : 0;
|
$is_active = in_array($multiline->id, [1, 2, 9, 10, 16, 17, 22, 23]) ? 1 : 0;
|
||||||
|
|
||||||
BettypeUser::firstOrCreate(
|
BettypeUser::firstOrCreate(
|
||||||
['sport_id' => $sport_id, 'user_id' => $user->id, 'multiline_setting_id' => $multiline_setting_id],
|
['sport_id' => $multiline->sport_id, 'user_id' => $user->id, 'multiline_setting_id' => $multiline->id],
|
||||||
['is_active' => $is_active]
|
['is_active' => $multiline->is_active, 'sorting' => $multiline->sorting],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,29 +115,30 @@ class EventsTable
|
|||||||
->verticalAlignment(VerticalAlignment::Start)
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
->label('1X2'),
|
->label('1X2'),
|
||||||
|
|
||||||
TooltipOdds::make('total')->bettype('odds_totals')->label('')->visible(fn () => in_array('odds_totals', self::$bettype_settings)),
|
|
||||||
ColumnOdds::make('odds_totals')->bettype('odds_totals')
|
|
||||||
->visible(fn () => in_array('odds_totals', self::$bettype_settings))
|
|
||||||
->verticalAlignment(VerticalAlignment::Start)
|
|
||||||
->label('Totals'),
|
|
||||||
|
|
||||||
TooltipOdds::make('1x2ht')->bettype('odds_3ways_ht')->label('')->visible(fn () => in_array('odds_3ways_ht', self::$bettype_settings)),
|
TooltipOdds::make('1x2ht')->bettype('odds_3ways_ht')->label('')->visible(fn () => in_array('odds_3ways_ht', self::$bettype_settings)),
|
||||||
ColumnOdds::make('odds_3ways_ht')->bettype('odds_3ways_ht')
|
ColumnOdds::make('odds_3ways_ht')->bettype('odds_3ways_ht')
|
||||||
->visible(fn () => in_array('odds_3ways_ht', self::$bettype_settings))
|
->visible(fn () => in_array('odds_3ways_ht', self::$bettype_settings))
|
||||||
->verticalAlignment(VerticalAlignment::Start)
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
->label('1X2 HT'),
|
->label('1X2 HT'),
|
||||||
|
|
||||||
|
TooltipOdds::make('total')->bettype('odds_totals')->label('')->visible(fn () => in_array('odds_totals', self::$bettype_settings)),
|
||||||
|
ColumnOdds::make('odds_totals')->bettype('odds_totals')
|
||||||
|
->visible(fn () => in_array('odds_totals', self::$bettype_settings))
|
||||||
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
|
->label('Totals'),
|
||||||
|
|
||||||
TooltipOdds::make('total_ht')->bettype('odds_totals_ht')->label('')->visible(fn () => in_array('odds_totals_ht', self::$bettype_settings)),
|
TooltipOdds::make('total_ht')->bettype('odds_totals_ht')->label('')->visible(fn () => in_array('odds_totals_ht', self::$bettype_settings)),
|
||||||
ColumnOdds::make('odds_totals_ht')->bettype('odds_totals_ht')
|
ColumnOdds::make('odds_totals_ht')->bettype('odds_totals_ht')
|
||||||
->visible(fn () => in_array('odds_totals_ht', self::$bettype_settings))
|
->visible(fn () => in_array('odds_totals_ht', self::$bettype_settings))
|
||||||
->verticalAlignment(VerticalAlignment::Start)
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
->label('Totals HT'),
|
->label('Totals HT'),
|
||||||
|
|
||||||
TooltipOdds::make('ggng')->bettype('odds_ggng')->label('')->visible(fn () => in_array('odds_ggng', self::$bettype_settings)),
|
TooltipOdds::make('total_q1')->bettype('odds_totals_q1')->label('')->visible(fn () => in_array('odds_totals_q1', self::$bettype_settings)),
|
||||||
ColumnOdds::make('odds_ggng')->bettype('odds_ggng')
|
ColumnOdds::make('odds_totals_q1')->bettype('odds_totals_q1')
|
||||||
->visible(fn () => \in_array('odds_ggng', self::$bettype_settings))
|
->visible(fn () => in_array('odds_totals_q1', self::$bettype_settings))
|
||||||
->verticalAlignment(VerticalAlignment::Start)
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
->label('Goal No Goal'),
|
->alignCenter()
|
||||||
|
->label('Totals Q1'),
|
||||||
|
|
||||||
TooltipOdds::make('points')->bettype('odds_points')->label('')->visible(fn () => in_array('odds_points', self::$bettype_settings)),
|
TooltipOdds::make('points')->bettype('odds_points')->label('')->visible(fn () => in_array('odds_points', self::$bettype_settings)),
|
||||||
ColumnOdds::make('odds_points')->bettype('odds_points')
|
ColumnOdds::make('odds_points')->bettype('odds_points')
|
||||||
@@ -151,19 +152,18 @@ class EventsTable
|
|||||||
->verticalAlignment(VerticalAlignment::Start)
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
->label('Points HT'),
|
->label('Points HT'),
|
||||||
|
|
||||||
TooltipOdds::make('total_q1')->bettype('odds_totals_q1')->label('')->visible(fn () => in_array('odds_totals_q1', self::$bettype_settings)),
|
|
||||||
ColumnOdds::make('odds_totals_q1')->bettype('odds_totals_q1')
|
|
||||||
->visible(fn () => in_array('odds_totals_q1', self::$bettype_settings))
|
|
||||||
->verticalAlignment(VerticalAlignment::Start)
|
|
||||||
->alignCenter()
|
|
||||||
->label('Totals Q1'),
|
|
||||||
|
|
||||||
TooltipOdds::make('points_q1')->bettype('odds_points_q1')->label('')->visible(fn () => in_array('odds_points_q1', self::$bettype_settings)),
|
TooltipOdds::make('points_q1')->bettype('odds_points_q1')->label('')->visible(fn () => in_array('odds_points_q1', self::$bettype_settings)),
|
||||||
ColumnOdds::make('odds_points_q1')->bettype('odds_points_q1')
|
ColumnOdds::make('odds_points_q1')->bettype('odds_points_q1')
|
||||||
->visible(fn () => in_array('odds_points_q1', self::$bettype_settings))
|
->visible(fn () => in_array('odds_points_q1', self::$bettype_settings))
|
||||||
->verticalAlignment(VerticalAlignment::Start)
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
->label('Points Q1'),
|
->label('Points Q1'),
|
||||||
|
|
||||||
|
TooltipOdds::make('ggng')->bettype('odds_ggng')->label('')->visible(fn () => in_array('odds_ggng', self::$bettype_settings)),
|
||||||
|
ColumnOdds::make('odds_ggng')->bettype('odds_ggng')
|
||||||
|
->visible(fn () => \in_array('odds_ggng', self::$bettype_settings))
|
||||||
|
->verticalAlignment(VerticalAlignment::Start)
|
||||||
|
->label('Goal No Goal'),
|
||||||
|
|
||||||
TooltipOdds::make('dc')->bettype('odds_dc')->label('')->visible(fn () => in_array('odds_dc', self::$bettype_settings)),
|
TooltipOdds::make('dc')->bettype('odds_dc')->label('')->visible(fn () => in_array('odds_dc', self::$bettype_settings)),
|
||||||
ColumnOdds::make('odds_dc')->bettype('odds_dc')
|
ColumnOdds::make('odds_dc')->bettype('odds_dc')
|
||||||
->visible(fn () => \in_array('odds_dc', self::$bettype_settings))
|
->visible(fn () => \in_array('odds_dc', self::$bettype_settings))
|
||||||
|
|||||||
@@ -3,17 +3,9 @@
|
|||||||
namespace App\Filament\Resources\MultilineSettings\Pages;
|
namespace App\Filament\Resources\MultilineSettings\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\MultilineSettings\MultilineSettingResource;
|
use App\Filament\Resources\MultilineSettings\MultilineSettingResource;
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListMultilineSettings extends ListRecords
|
class ListMultilineSettings extends ListRecords
|
||||||
{
|
{
|
||||||
protected static string $resource = MultilineSettingResource::class;
|
protected static string $resource = MultilineSettingResource::class;
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
CreateAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,9 @@ class MultilineSettingsTable
|
|||||||
TextColumn::make('short'),
|
TextColumn::make('short'),
|
||||||
TextColumn::make('table'),
|
TextColumn::make('table'),
|
||||||
TextColumn::make('rows'),
|
TextColumn::make('rows'),
|
||||||
|
TextColumn::make('sorting')->alignCenter()->badge(),
|
||||||
])
|
])
|
||||||
|
->reorderable('sorting')
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->filters([
|
->filters([
|
||||||
SelectFilter::make('sport_id')
|
SelectFilter::make('sport_id')
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class BettypeUser extends Model
|
|||||||
'user_id',
|
'user_id',
|
||||||
'sport_id',
|
'sport_id',
|
||||||
'multiline_setting_id',
|
'multiline_setting_id',
|
||||||
|
'sorting',
|
||||||
'is_active',
|
'is_active',
|
||||||
'unique_key',
|
'unique_key',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class MultilineSetting extends Model
|
|||||||
'name',
|
'name',
|
||||||
'short',
|
'short',
|
||||||
'table',
|
'table',
|
||||||
|
'sorting',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function sport()
|
public function sport()
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ return new class extends Migration
|
|||||||
$table->string('matchpart');
|
$table->string('matchpart');
|
||||||
$table->integer('rows')->default(4);
|
$table->integer('rows')->default(4);
|
||||||
$table->integer('has_3_columns')->default(0);
|
$table->integer('has_3_columns')->default(0);
|
||||||
|
$table->integer('sorting')->default(0)->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ return new class extends Migration
|
|||||||
$table->integer('user_id')->index();
|
$table->integer('user_id')->index();
|
||||||
$table->integer('sport_id')->index()->references('id')->on('sports');
|
$table->integer('sport_id')->index()->references('id')->on('sports');
|
||||||
$table->integer('multiline_setting_id')->index();
|
$table->integer('multiline_setting_id')->index();
|
||||||
|
$table->integer('sorting')->default(0)->nullable();
|
||||||
$table->boolean('is_active')->default(false);
|
$table->boolean('is_active')->default(false);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user