Files
nuhodds_fi4/app/Actions/MultilineSlots.php
T
2025-12-13 09:57:15 +01:00

36 lines
914 B
PHP

<?php
namespace App\Actions;
use App\Models\Multiline;
class MultilineSlots
{
public static function addSlots(&$data, $bettype_id, $matchpart_id)
{
$slots = Multiline::where('sport_id', auth()->user()->sport_id)
->where('client_id', auth()->user()->client_id)
->where('bettype_id', $bettype_id)
->where('matchpart_id', $matchpart_id)
->with('bookmaker')
->orderBy('sort')
->get();
$multilines = [];
foreach ($slots as $id => $slot) {
$open = true;
foreach ($data as $item) {
if ($slot->bookmaker_id == $item->bookmaker_id) {
$multilines[$id] = $item;
$open = false;
}
}
if ($open) {
$multilines[$id] = $slot;
}
}
return $multilines;
}
}