fix carbon
This commit is contained in:
1 parent
3af30b34b5
commit
d0915a611e
12 files changed
+282
-44
No files matched your search
@@ -4,6 +4,7 @@ namespace App\Actions;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\OddsTable;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AlarmStatistic
|
||||
{
|
||||
@@ -17,7 +18,7 @@ class AlarmStatistic
|
||||
|
||||
$events = Event::with('event_bookmaker')
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->whereDate('starttime', '>=', now())
|
||||
->whereDate('starttime', '>=', Carbon::now())
|
||||
->whereHas('event_bookmaker', function ($query) {
|
||||
$query->where('bookmaker_id', auth()->user()->bookmaker_id);
|
||||
})
|
||||
|
||||
@@ -107,11 +107,11 @@ class GenerateSetting
|
||||
|
||||
foreach ($multilines as $multiline) {
|
||||
|
||||
$is_active = in_array($multiline->id, [1, 2, 9, 10, 16, 17, 22, 23]) ? 1 : 0;
|
||||
$is_active = in_array($multiline->id, [1, 2, 9, 10, 16, 17, 22, 23]) ? true : false;
|
||||
|
||||
BettypeUser::updateOrCreate(
|
||||
['sport_id' => $multiline->sport_id, 'user_id' => $user->id, 'multiline_setting_id' => $multiline->id],
|
||||
['is_active' => $multiline->is_active, 'sorting' => $multiline->sorting],
|
||||
['is_active' => $is_active, 'sorting' => $multiline->sorting],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Filament\Resources\Events\Tables\EventsTable;
|
||||
use App\Filament\Resources\Events\Tables\Tools\LoadPartnerDifferences;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
@@ -48,7 +49,7 @@ class EventResource extends Resource
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->where('sport_id', auth()->user()->sport_id)
|
||||
->whereDate('starttime', '>', now())
|
||||
->whereDate('starttime', '>=', Carbon::now())
|
||||
->count();
|
||||
}
|
||||
|
||||
@@ -66,9 +67,9 @@ class EventResource extends Resource
|
||||
->where('sport_id', auth()->user()->sport_id);
|
||||
|
||||
if (config('env.app_env') == 'production') {
|
||||
$query->whereDate('starttime', '>=', now()->subHour());
|
||||
$query->whereDate('starttime', '>=', Carbon::now()->subHour());
|
||||
} else {
|
||||
$query->whereDate('starttime', '>=', now());
|
||||
$query->whereDate('starttime', '>=', Carbon::now());
|
||||
}
|
||||
|
||||
if (auth()->user()->all_only_none > 0) {
|
||||
|
||||
@@ -205,7 +205,7 @@ class EventsTable
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(function () {
|
||||
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->whereDate('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
$res = Event::where('has_markets', 1)->where('sport_id', auth()->user()->sport_id)->whereDate('starttime', '>=', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||
|
||||
return Country::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
|
||||
})
|
||||
|
||||
@@ -15,6 +15,18 @@ class BettypeUser extends Model
|
||||
'unique_key',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function multiline_setting()
|
||||
{
|
||||
return $this->belongsTo(MultilineSetting::class);
|
||||
|
||||
@@ -75,6 +75,11 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
|
||||
'app_authentication_secret' => 'encrypted',
|
||||
'app_authentication_recovery_codes' => 'encrypted:array',
|
||||
'has_email_authentication' => 'boolean',
|
||||
'is_multiline_direct' => 'boolean',
|
||||
'all_only_none' => 'boolean',
|
||||
'partner_show' => 'boolean',
|
||||
'partner_compare' => 'boolean',
|
||||
'bookmaker_partner_differences' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class CompetitionGroupProviderPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, CompetitionGroupProvider $competitionGroupProvider): bool
|
||||
{
|
||||
return $authUser->can('View:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, CompetitionGroupProvider $competitionGroupProvider): bool
|
||||
{
|
||||
return $authUser->can('Update:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, CompetitionGroupProvider $competitionGroupProvider): bool
|
||||
{
|
||||
return $authUser->can('Delete:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, CompetitionGroupProvider $competitionGroupProvider): bool
|
||||
{
|
||||
return $authUser->can('Restore:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, CompetitionGroupProvider $competitionGroupProvider): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, CompetitionGroupProvider $competitionGroupProvider): bool
|
||||
{
|
||||
return $authUser->can('Replicate:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:CompetitionGroupProvider');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\Element;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class ElementPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:Element');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, Element $element): bool
|
||||
{
|
||||
return $authUser->can('View:Element');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:Element');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, Element $element): bool
|
||||
{
|
||||
return $authUser->can('Update:Element');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, Element $element): bool
|
||||
{
|
||||
return $authUser->can('Delete:Element');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, Element $element): bool
|
||||
{
|
||||
return $authUser->can('Restore:Element');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, Element $element): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:Element');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:Element');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:Element');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, Element $element): bool
|
||||
{
|
||||
return $authUser->can('Replicate:Element');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Element');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
use App\Models\ElementProvider;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class ElementProviderPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:ElementProvider');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, ElementProvider $elementProvider): bool
|
||||
{
|
||||
return $authUser->can('View:ElementProvider');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:ElementProvider');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, ElementProvider $elementProvider): bool
|
||||
{
|
||||
return $authUser->can('Update:ElementProvider');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, ElementProvider $elementProvider): bool
|
||||
{
|
||||
return $authUser->can('Delete:ElementProvider');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, ElementProvider $elementProvider): bool
|
||||
{
|
||||
return $authUser->can('Restore:ElementProvider');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, ElementProvider $elementProvider): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:ElementProvider');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:ElementProvider');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:ElementProvider');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, ElementProvider $elementProvider): bool
|
||||
{
|
||||
return $authUser->can('Replicate:ElementProvider');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:ElementProvider');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user