fumetto 1col & 2col
This commit is contained in:
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';
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user