popup time order by bookmaker name
This commit is contained in:
1 parent
5a44fc18b3
commit
79271f22e1
2 files changed
+30
-29
No files matched your search
@@ -317,16 +317,14 @@ class Odds
|
||||
case 0:
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
|
||||
case 'starting_time':
|
||||
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
if ($res && $res->starttime != $attributeValue) {
|
||||
$res->starttime = $attributeValue;
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event_id,
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => $attributeValue]);
|
||||
}, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -337,14 +335,13 @@ class Odds
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
case 'starting_time':
|
||||
|
||||
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
if ($res && $res->starttime != $attributeValue) {
|
||||
$res->starttime = $attributeValue;
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event_id,
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => $attributeValue]);
|
||||
}, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -356,14 +353,13 @@ class Odds
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
case 'starting_time':
|
||||
|
||||
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
if ($res && $res->starttime != $attributeValue) {
|
||||
$res->starttime = $attributeValue;
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event_id,
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => $attributeValue]);
|
||||
}, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\EventBookmaker;
|
||||
use Filament\Support\Components\Contracts\HasEmbeddedView;
|
||||
use Filament\Tables\Columns\Column;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ColumnStarttime extends Column implements HasEmbeddedView
|
||||
{
|
||||
@@ -13,14 +14,18 @@ class ColumnStarttime extends Column implements HasEmbeddedView
|
||||
{
|
||||
$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>'.$record->starttime.'</div>';
|
||||
$pop .= '<div class="text-right">'.date('H:i:s', strtotime($record->starttime)).'</div>';
|
||||
foreach ($bookmaker_starttimes as $value) {
|
||||
$pop .= '<div>'.$value->bookmaker->name.'</div>';
|
||||
$pop .= '<div>'.$value->starttime.'</div>';
|
||||
$pop .= '<div class="text-right">'.$value->starttime.'</div>';
|
||||
}
|
||||
$pop .= '<div>';
|
||||
|
||||
|
||||
Reference in new issue
Block a user