fumetto 1col & 2col

This commit is contained in:
salam committed 2026-01-22 09:08:54 +01:00
1 parent 937c5908d2
commit 531b4c0dc9
34 files changed
+809 -673

No files matched your search

@@ -61,6 +61,10 @@ class EventResource extends Resource
->with('event_user_star')
->where('sport_id', auth()->user()->sport_id);
if (auth()->user()->stars) {
$query->whereHas('event_user_star');
}
if (in_array('odds_2ways', EventsTable::$bettype_settings)) {
$query->with('odds_2ways.bookmaker');
}
@@ -283,70 +283,65 @@ class EventsTable
->live(),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
self::$user->stars,
fn (Builder $query) => $query->whereHas('event_user_star')
)
->when(
$data['country_id'],
fn (Builder $query, $country_id) => $query->where('country_id', $country_id)
)->when(
$data['group_id'],
fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id)
)->when(
$data['competition_group_id'],
fn (Builder $query, $competition_group_id) => $query->whereIn('competition_group_id', $competition_group_id)
)->when(
$data['starttime_period'],
function (Builder $query, $starttime_period) {
if (isset($starttime_period['start']) && isset($starttime_period['end'])) {
$from = Carbon::createFromDate($starttime_period['start']);
$end = Carbon::createFromDate($starttime_period['end']);
return $query->when(
$data['country_id'],
fn (Builder $query, $country_id) => $query->where('country_id', $country_id)
)->when(
$data['group_id'],
fn (Builder $query, $group_id) => $query->whereIn('group_id', $group_id)
)->when(
$data['competition_group_id'],
fn (Builder $query, $competition_group_id) => $query->whereIn('competition_group_id', $competition_group_id)
)->when(
$data['starttime_period'],
function (Builder $query, $starttime_period) {
if (isset($starttime_period['start']) && isset($starttime_period['end'])) {
$from = Carbon::createFromDate($starttime_period['start']);
$end = Carbon::createFromDate($starttime_period['end']);
return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
} elseif (isset($starttime_period['start'])) {
$from = Carbon::createFromDate($starttime_period['start']);
return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
} elseif (isset($starttime_period['start'])) {
$from = Carbon::createFromDate($starttime_period['start']);
return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'));
} elseif (isset($starttime_period['end'])) {
$end = Carbon::createFromDate($starttime_period['end']);
return $query
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'));
} elseif (isset($starttime_period['end'])) {
$end = Carbon::createFromDate($starttime_period['end']);
return $query
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
}
return $query
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
}
);
}
);
})->indicateUsing(function (array $data): array {
$indicators = [];
if ($data['country_id'] ?? null) {
$countries = Country::whereIn('id', $data['country_id'])->pluck('name')->toArray();
if (count($countries) > 1) {
$indicators[] = Indicator::make('Countries: '.implode(', ', $countries))->removeField('country_id');
$indicators[] = Indicator::make('Countries: '.implode(', ', $countries))->removeField('country_id')->color('info');
} else {
$indicators[] = Indicator::make('Country: '.$countries[0])->removeField('country_id');
$indicators[] = Indicator::make('Country: '.$countries[0])->removeField('country_id')->color('info');
}
}
if ($data['group_id'] ?? null) {
$group_ids = Group::whereIn('id', $data['group_id'])->pluck('name')->toArray();
if (count($group_ids) > 1) {
$indicators[] = Indicator::make('Tournament: '.implode(', ', $group_ids))->removeField('group_id');
$indicators[] = Indicator::make('Tournament: '.implode(', ', $group_ids))->removeField('group_id')->color('info');
} else {
$indicators[] = Indicator::make('Tournaments: '.$group_ids[0])->removeField('group_id');
$indicators[] = Indicator::make('Tournaments: '.$group_ids[0])->removeField('group_id')->color('info');
}
}
if ($data['competition_group_id'] ?? null) {
$competition_groups = CompetitionGroup::whereIn('id', $data['competition_group_id'])->pluck('name')->toArray();
if (count($competition_groups) > 1) {
$indicators[] = Indicator::make('Leagues: '.implode(', ', $competition_groups))->removeField('competition_group_id');
$indicators[] = Indicator::make('Leagues: '.implode(', ', $competition_groups))->removeField('competition_group_id')->color('info');
} else {
$indicators[] = Indicator::make('League: '.$competition_groups[0])->removeField('competition_group_id');
$indicators[] = Indicator::make('League: '.$competition_groups[0])->removeField('competition_group_id')->color('info')->color('info');
}
}
@@ -360,12 +355,12 @@ class EventsTable
$text .= ' To '.Carbon::parse($span['end'])->toFormattedDateString();
}
if ($text) {
$indicators[] = Indicator::make($text)->removeField('starttime_period.start');
$indicators[] = Indicator::make($text)->removeField('starttime_period.start')->color('info');
}
}
if ($data['stars_status'] ?? null) {
$indicators[] = Indicator::make('Favorits')->removeField('stars_status');
$indicators[] = Indicator::make('Favorits')->removeField('stars_status')->color('info');
}
return $indicators;
@@ -381,8 +376,6 @@ class EventsTable
if (isset($record->event_user_star->id)) {
return 'phosphor-star-fill';
} else {
// dd($record->event_user_stars);
return 'phosphor-star';
}
})
+2 -2
View File
@@ -16,7 +16,7 @@ class Column3way extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class Column3way extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_3ways) ? true : false;
$this->has_data = count($record->odds_3ways);
$this->act = $record->odds_3ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class Column3wayHt extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class Column3wayHt extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_3ways_ht) ? true : false;
$this->has_data = count($record->odds_3ways_ht);
$this->act = $record->odds_3ways_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnDc extends Column
protected ?array $bookmakers;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnDc extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_dc) ? true : false;
$this->has_data = count($record->odds_dc);
$this->act = $record->odds_dc->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnDnb extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnDnb extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_dnb) ? true : false;
$this->has_data = count($record->odds_dnb);
$this->act = $record->odds_dnb->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnGgng extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnGgng extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_ggng) ? true : false;
$this->has_data = count($record->odds_ggng);
$this->act = $record->odds_ggng->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnMl extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnMl extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_2ways) ? true : false;
$this->has_data = count($record->odds_2ways);
$this->act = $record->odds_2ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnMlS1 extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnMlS1 extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_2ways_s1) ? true : false;
$this->has_data = count($record->odds_2ways_s1);
$this->act = $record->odds_2ways->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnPoint extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnPoint extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_points) ? true : false;
$this->has_data = count($record->odds_points);
$this->act = $record->odds_points->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
@@ -16,7 +16,7 @@ class ColumnPointQ1 extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnPointQ1 extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_points_q1) ? true : false;
$this->has_data = count($record->odds_points_q1);
$this->act = $record->odds_points_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnTotal extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnTotal extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_totals) ? true : false;
$this->has_data = count($record->odds_totals);
$this->act = $record->odds_totals->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
@@ -16,7 +16,7 @@ class ColumnTotalHt extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnTotalHt extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_totals_ht) ? true : false;
$this->has_data = count($record->odds_totals_ht);
$this->act = $record->odds_totals_ht->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
@@ -16,7 +16,7 @@ class ColumnTotalQ1 extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnTotalQ1 extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_totals_q1) ? true : false;
$this->has_data = count($record->odds_totals_q1);
$this->act = $record->odds_totals_q1->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+2 -2
View File
@@ -16,7 +16,7 @@ class ColumnTq extends Column
protected $act;
protected ?bool $has_data;
protected ?int $has_data;
public function bookmakers(?array $bookmakers): static
{
@@ -37,7 +37,7 @@ class ColumnTq extends Column
public function loadData($record)
{
$this->has_data = count($record->odds_tq) ? true : false;
$this->has_data = count($record->odds_tq);
$this->act = $record->odds_tq->where('bookmaker_id', auth()->user()->bookmaker_id)->first();
+1 -1
View File
@@ -38,7 +38,7 @@ class FilterOdds
$checked_at = Carbon::createFromDate($model->checked_at)->timestamp;
if (! isset($filter['margin'])) {
dd($model->bookmaker_id);
Bookmakers::updateOrCreate(['id' => (int) $model->bookmaker_id], ['need_check' => 1]);
}
if ($model->margin <= $filter['margin'] && $checked_at > time() - $filter['time_lastcheck']) {