popup time order by bookmaker name

This commit is contained in:
salam committed 2026-02-25 17:03:05 +01:00
1 parent 5a44fc18b3
commit 79271f22e1
2 files changed
+30 -29

No files matched your search

+21 -25
View File
@@ -317,16 +317,14 @@ class Odds
case 0: case 0:
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) { foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
switch ($attributeName) { switch ($attributeName) {
case 'starting_time': case 'starting_time':
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first(); DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
if ($res && $res->starttime != $attributeValue) { EventBookmaker::updateOrCreate([
$res->starttime = $attributeValue; 'event_id' => $event_id,
DB::transaction(function () use ($res) { 'sport_id' => $sport_id,
$res->save(); 'bookmaker_id' => $bookmaker_id,
}, 5); ], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => $attributeValue]);
}, 5);
}
break; break;
} }
} }
@@ -337,14 +335,13 @@ class Odds
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) { foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
switch ($attributeName) { switch ($attributeName) {
case 'starting_time': case 'starting_time':
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first(); EventBookmaker::updateOrCreate([
if ($res && $res->starttime != $attributeValue) { 'event_id' => $event_id,
$res->starttime = $attributeValue; 'sport_id' => $sport_id,
DB::transaction(function () use ($res) { 'bookmaker_id' => $bookmaker_id,
$res->save(); ], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => $attributeValue]);
}, 5); }, 5);
}
break; break;
} }
} }
@@ -356,14 +353,13 @@ class Odds
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) { foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
switch ($attributeName) { switch ($attributeName) {
case 'starting_time': case 'starting_time':
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first(); EventBookmaker::updateOrCreate([
if ($res && $res->starttime != $attributeValue) { 'event_id' => $event_id,
$res->starttime = $attributeValue; 'sport_id' => $sport_id,
DB::transaction(function () use ($res) { 'bookmaker_id' => $bookmaker_id,
$res->save(); ], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => $attributeValue]);
}, 5); }, 5);
}
break; break;
} }
} }
@@ -6,6 +6,7 @@ use App\Models\EventBookmaker;
use Filament\Support\Components\Contracts\HasEmbeddedView; use Filament\Support\Components\Contracts\HasEmbeddedView;
use Filament\Tables\Columns\Column; use Filament\Tables\Columns\Column;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class ColumnStarttime extends Column implements HasEmbeddedView class ColumnStarttime extends Column implements HasEmbeddedView
{ {
@@ -13,14 +14,18 @@ class ColumnStarttime extends Column implements HasEmbeddedView
{ {
$record = $this->getRecord(); $record = $this->getRecord();
$bookmaker_starttimes = EventBookmaker::with('bookmaker')->where('event_id', $record->id)->select('bookmaker_id', 'starttime')->get(); $bookmaker_starttimes = EventBookmaker::where('event_id', $record->id)
->join('bookmakers', 'bookmakers.id', '=', 'event_bookmakers.bookmaker_id')
->select('bookmaker_id', DB::raw('TIME(starttime) AS starttime'))
->orderBy('bookmakers.name')
->get();
$pop = '<div class="grid grid-cols-2 gap-1">'; $pop = '<div class="grid grid-cols-2 gap-1 text-xs m-2">';
$pop .= '<div>TxOdds</div>'; $pop .= '<div>TxOdds</div>';
$pop .= '<div>'.$record->starttime.'</div>'; $pop .= '<div class="text-right">'.date('H:i:s', strtotime($record->starttime)).'</div>';
foreach ($bookmaker_starttimes as $value) { foreach ($bookmaker_starttimes as $value) {
$pop .= '<div>'.$value->bookmaker->name.'</div>'; $pop .= '<div>'.$value->bookmaker->name.'</div>';
$pop .= '<div>'.$value->starttime.'</div>'; $pop .= '<div class="text-right">'.$value->starttime.'</div>';
} }
$pop .= '<div>'; $pop .= '<div>';