wip
This commit is contained in:
1 parent
d62d5c5e8e
commit
1723221b88
16 files changed
+980
-16502
No files matched your search
@@ -60,7 +60,7 @@ class Fixtures
|
||||
// </results>
|
||||
// </match>
|
||||
$event = [];
|
||||
$event['txodds_id'] = (int) $row['id'];
|
||||
$event['tx_id'] = (int) $row['id'];
|
||||
$event['starttime'] = Carbon::createFromDate((string) $row->time)->toDateTimeString();
|
||||
$group_name = (string) $row->group;
|
||||
$event['group_id'] = (int) $row->group['id'];
|
||||
@@ -74,7 +74,7 @@ class Fixtures
|
||||
$event['away_id'] = (int) $row->ateam['id'];
|
||||
|
||||
Group::updateOrCreate([
|
||||
'txodds_id' => $event['group_id'],
|
||||
'tx_id' => $event['group_id'],
|
||||
'competition_group_id' => $event['competition_group_id'],
|
||||
'sport_id' => $event['sport_id'],
|
||||
'country_id' => $event['country_id'],
|
||||
@@ -83,7 +83,7 @@ class Fixtures
|
||||
]);
|
||||
|
||||
CompetitionGroup::updateOrCreate([
|
||||
'txodds_id' => $event['competition_group_id'],
|
||||
'tx_id' => $event['competition_group_id'],
|
||||
'sport_id' => $event['sport_id'],
|
||||
'country_id' => $event['country_id'],
|
||||
], [
|
||||
@@ -91,13 +91,13 @@ class Fixtures
|
||||
]);
|
||||
|
||||
Element::firstOrCreate([
|
||||
'txodds_id' => $event['home_id'],
|
||||
'tx_id' => $event['home_id'],
|
||||
'name' => $home,
|
||||
'sport_id' => $event['sport_id'],
|
||||
]);
|
||||
|
||||
Element::firstOrCreate([
|
||||
'txodds_id' => $event['away_id'],
|
||||
'tx_id' => $event['away_id'],
|
||||
'name' => $away,
|
||||
'sport_id' => $event['sport_id'],
|
||||
]);
|
||||
|
||||
@@ -112,12 +112,12 @@ class Odds
|
||||
if (NuhBash::$options['event_id']) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".NuhBash::$options['event_id'];
|
||||
} elseif (NuhBash::$options['a']) {
|
||||
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('txodds_id');
|
||||
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('tx_id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} elseif (NuhBash::$options['w']) {
|
||||
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('txodds_id');
|
||||
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('tx_id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class Odds
|
||||
foreach ($data as $row) {
|
||||
|
||||
$event = [];
|
||||
$event['txodds_id'] = (int) $row['id'];
|
||||
$event['tx_id'] = (int) $row['id'];
|
||||
$event['starttime'] = Carbon::createFromDate((string) $row->time)->toDateTimeString();
|
||||
$group_name = (string) $row->group;
|
||||
$event['group_id'] = (int) $row->group['id'];
|
||||
@@ -149,7 +149,7 @@ class Odds
|
||||
$event['away_id'] = (int) $row->ateam['id'];
|
||||
|
||||
Group::updateOrCreate([
|
||||
'txodds_id' => $event['group_id'],
|
||||
'tx_id' => $event['group_id'],
|
||||
'competition_group_id' => $event['competition_group_id'],
|
||||
'sport_id' => $event['sport_id'],
|
||||
'country_id' => $event['country_id'],
|
||||
@@ -158,7 +158,7 @@ class Odds
|
||||
]);
|
||||
|
||||
CompetitionGroup::updateOrCreate([
|
||||
'txodds_id' => $event['competition_group_id'],
|
||||
'tx_id' => $event['competition_group_id'],
|
||||
'sport_id' => $event['sport_id'],
|
||||
'country_id' => $event['country_id'],
|
||||
], [
|
||||
@@ -166,13 +166,13 @@ class Odds
|
||||
]);
|
||||
|
||||
Element::firstOrCreate([
|
||||
'txodds_id' => $event['home_id'],
|
||||
'tx_id' => $event['home_id'],
|
||||
'name' => $home,
|
||||
'sport_id' => $event['sport_id'],
|
||||
]);
|
||||
|
||||
Element::firstOrCreate([
|
||||
'txodds_id' => $event['away_id'],
|
||||
'tx_id' => $event['away_id'],
|
||||
'name' => $away,
|
||||
'sport_id' => $event['sport_id'],
|
||||
]);
|
||||
|
||||
+926
-16316
File diff suppressed because it is too large.
Load diff
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Events\Tables;
|
||||
|
||||
use App\Filament\Tables\Columns\MultilineClient;
|
||||
use App\Models\Event;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
@@ -10,6 +11,8 @@ use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class EventsTable
|
||||
@@ -17,7 +20,6 @@ class EventsTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->poll('10s')
|
||||
->striped()
|
||||
->columns([
|
||||
IconColumn::make('sport.icon')
|
||||
@@ -26,7 +28,7 @@ class EventsTable
|
||||
->size(IconSize::ExtraLarge)
|
||||
->icon(fn ($record) => $record->sport->icon)
|
||||
->tooltip(fn ($record) => $record->id),
|
||||
TextColumn::make('txodds_id')->label('Id')->badge()->copyable()->searchable(),
|
||||
TextColumn::make('tx_id')->label('Id')->badge()->copyable()->searchable(),
|
||||
TextColumn::make('starttime')
|
||||
->label('Start')
|
||||
->alignCenter()
|
||||
@@ -46,27 +48,31 @@ class EventsTable
|
||||
->label(fn () => view('filament.tables.columns.multiline-labels')),
|
||||
|
||||
])
|
||||
->poll('10s')
|
||||
->defaultSort('starttime', 'ASC')
|
||||
// ->filters([
|
||||
// SelectFilter::make('competition_group_id')
|
||||
// ->preload()
|
||||
// ->label('League')
|
||||
// ->multiple()
|
||||
// ->searchable()
|
||||
// ->options(function () {
|
||||
->filters([
|
||||
SelectFilter::make('competition_group_id')
|
||||
->preload()
|
||||
->label('League')
|
||||
->multiple()
|
||||
->searchable()
|
||||
->options(function () {
|
||||
|
||||
// $res = Event::with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
// $arr = [];
|
||||
// foreach ($res as $val) {
|
||||
// $arr[$val->competition_group_id] = $val->country->name.' - '.$val->competition_group->name;
|
||||
// }
|
||||
$res = Event::with('country')->with('competition_group')->where('starttime', '>', Carbon::now())->groupBy('competition_group_id')->get();
|
||||
$arr = [];
|
||||
foreach ($res as $val) {
|
||||
$arr[$val->competition_group_id] = $val->country->name.' - '.$val->competition_group->name;
|
||||
}
|
||||
|
||||
// asort($arr);
|
||||
asort($arr);
|
||||
|
||||
// return $arr;
|
||||
// })
|
||||
// ->selectablePlaceholder(false),
|
||||
// ], layout: FiltersLayout::AboveContent)
|
||||
return $arr;
|
||||
})
|
||||
->columnSpan(2 )
|
||||
->selectablePlaceholder(false),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->filtersFormColumns(6)
|
||||
->deferFilters(false)
|
||||
->persistFiltersInSession()
|
||||
->recordActions([
|
||||
// EditAction::make(),
|
||||
|
||||
@@ -8,7 +8,7 @@ class CompetitionGroup extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'txodds_id',
|
||||
'tx_id',
|
||||
'sport_id',
|
||||
'country_id',
|
||||
];
|
||||
|
||||
@@ -8,7 +8,7 @@ class Element extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'txodds_id',
|
||||
'tx_id',
|
||||
'sport_id',
|
||||
];
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class Event extends Model
|
||||
'competition_group_id',
|
||||
'home_id',
|
||||
'away_id',
|
||||
'txodds_id',
|
||||
'tx_id',
|
||||
'provider_id',
|
||||
'betaid_id',
|
||||
'betradar_id',
|
||||
@@ -27,27 +27,27 @@ class Event extends Model
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class, 'country_id', 'txodds_id');
|
||||
return $this->belongsTo(Country::class, 'country_id', 'tx_id');
|
||||
}
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->hasOne(Group::class, 'txodds_id', 'group_id');
|
||||
return $this->hasOne(Group::class, 'tx_id', 'group_id');
|
||||
}
|
||||
|
||||
public function competition_group()
|
||||
{
|
||||
return $this->hasOne(CompetitionGroup::class, 'txodds_id', 'competition_group_id');
|
||||
return $this->hasOne(CompetitionGroup::class, 'tx_id', 'competition_group_id');
|
||||
}
|
||||
|
||||
public function home()
|
||||
{
|
||||
return $this->hasOne(Element::class, 'txodds_id', 'home_id');
|
||||
return $this->hasOne(Element::class, 'tx_id', 'home_id');
|
||||
}
|
||||
|
||||
public function away()
|
||||
{
|
||||
return $this->hasOne(Element::class, 'txodds_id', 'away_id');
|
||||
return $this->hasOne(Element::class, 'tx_id', 'away_id');
|
||||
}
|
||||
|
||||
public function multiline_client()
|
||||
|
||||
@@ -8,7 +8,7 @@ class Group extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'txodds_id',
|
||||
'tx_id',
|
||||
'competition_group_id',
|
||||
'sport_id',
|
||||
'country_id',
|
||||
|
||||
Reference in new issue
Block a user