36 lines
920 B
PHP
36 lines
920 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;
|
|
}
|
|
}
|