From d0915a611e773bb15e2a67e600c565a363bb0525 Mon Sep 17 00:00:00 2001 From: salam Date: Tue, 24 Feb 2026 11:51:00 +0100 Subject: [PATCH] fix carbon --- app/Actions/AlarmStatistic.php | 3 +- .../Services/Tasks/GenerateSetting.php | 4 +- .../Resources/Events/EventResource.php | 7 +- .../Resources/Events/Tables/EventsTable.php | 2 +- app/Models/BettypeUser.php | 12 ++++ app/Models/User.php | 5 ++ .../CompetitionGroupProviderPolicy.php | 70 +++++++++++++++++++ app/Policies/ElementPolicy.php | 70 +++++++++++++++++++ app/Policies/ElementProviderPolicy.php | 70 +++++++++++++++++++ composer.lock | 22 +++--- database/seeders/MultilineSettingSeeder.php | 52 +++++++------- setup.sh | 9 ++- 12 files changed, 282 insertions(+), 44 deletions(-) create mode 100644 app/Policies/CompetitionGroupProviderPolicy.php create mode 100644 app/Policies/ElementPolicy.php create mode 100644 app/Policies/ElementProviderPolicy.php diff --git a/app/Actions/AlarmStatistic.php b/app/Actions/AlarmStatistic.php index cbfd7e24..aceeca81 100644 --- a/app/Actions/AlarmStatistic.php +++ b/app/Actions/AlarmStatistic.php @@ -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); }) diff --git a/app/Console/Commands/Services/Tasks/GenerateSetting.php b/app/Console/Commands/Services/Tasks/GenerateSetting.php index 0465b6a1..69d869b9 100644 --- a/app/Console/Commands/Services/Tasks/GenerateSetting.php +++ b/app/Console/Commands/Services/Tasks/GenerateSetting.php @@ -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], ); } } diff --git a/app/Filament/Resources/Events/EventResource.php b/app/Filament/Resources/Events/EventResource.php index 448c8574..9415f7c1 100644 --- a/app/Filament/Resources/Events/EventResource.php +++ b/app/Filament/Resources/Events/EventResource.php @@ -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) { diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index 53566fbe..7c9b0bfa 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -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'); }) diff --git a/app/Models/BettypeUser.php b/app/Models/BettypeUser.php index eb45add9..7a287604 100644 --- a/app/Models/BettypeUser.php +++ b/app/Models/BettypeUser.php @@ -15,6 +15,18 @@ class BettypeUser extends Model 'unique_key', ]; + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'is_active' => 'boolean', + ]; + } + public function multiline_setting() { return $this->belongsTo(MultilineSetting::class); diff --git a/app/Models/User.php b/app/Models/User.php index 8d875023..d8c6a3c3 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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', ]; } diff --git a/app/Policies/CompetitionGroupProviderPolicy.php b/app/Policies/CompetitionGroupProviderPolicy.php new file mode 100644 index 00000000..9459b534 --- /dev/null +++ b/app/Policies/CompetitionGroupProviderPolicy.php @@ -0,0 +1,70 @@ +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'); + } + +} \ No newline at end of file diff --git a/app/Policies/ElementPolicy.php b/app/Policies/ElementPolicy.php new file mode 100644 index 00000000..187b2e3f --- /dev/null +++ b/app/Policies/ElementPolicy.php @@ -0,0 +1,70 @@ +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'); + } + +} \ No newline at end of file diff --git a/app/Policies/ElementProviderPolicy.php b/app/Policies/ElementProviderPolicy.php new file mode 100644 index 00000000..df505d60 --- /dev/null +++ b/app/Policies/ElementProviderPolicy.php @@ -0,0 +1,70 @@ +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'); + } + +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 25c32310..259c162e 100644 --- a/composer.lock +++ b/composer.lock @@ -4759,16 +4759,16 @@ }, { "name": "nette/schema", - "version": "v1.3.4", + "version": "v1.3.5", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7" + "reference": "f0ab1a3cda782dbc5da270d28545236aa80c4002" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/086497a2f34b82fede9b5a41cc8e131d087cd8f7", - "reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7", + "url": "https://api.github.com/repos/nette/schema/zipball/f0ab1a3cda782dbc5da270d28545236aa80c4002", + "reference": "f0ab1a3cda782dbc5da270d28545236aa80c4002", "shasum": "" }, "require": { @@ -4776,8 +4776,10 @@ "php": "8.1 - 8.5" }, "require-dev": { + "nette/phpstan-rules": "^1.0", "nette/tester": "^2.6", - "phpstan/phpstan": "^2.0@stable", + "phpstan/extension-installer": "^1.4@stable", + "phpstan/phpstan": "^2.1.39@stable", "tracy/tracy": "^2.8" }, "type": "library", @@ -4818,9 +4820,9 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.4" + "source": "https://github.com/nette/schema/tree/v1.3.5" }, - "time": "2026-02-08T02:54:00+00:00" + "time": "2026-02-23T03:47:12+00:00" }, { "name": "nette/utils", @@ -13297,12 +13299,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.3" }, - "platform-dev": [], - "plugin-api-version": "2.6.0" + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/database/seeders/MultilineSettingSeeder.php b/database/seeders/MultilineSettingSeeder.php index 11b820c5..32d70e0c 100644 --- a/database/seeders/MultilineSettingSeeder.php +++ b/database/seeders/MultilineSettingSeeder.php @@ -12,33 +12,33 @@ class MultilineSettingSeeder extends Seeder /** * Clients */ - $sql = "INSERT INTO `multiline_settings` (`id`, `sport_id`, `name`, `short`, `table`, `oddnames`, `matchpart`, `rows`, `has_3_columns`, `created_at`, `updated_at`) + $sql = "INSERT INTO `multiline_settings` (`id`, `sport_id`, `name`, `short`, `table`, `oddnames`, `matchpart`, `rows`, `has_3_columns`, `sorting`, `created_at`, `updated_at`) VALUES - (10, 2, 'MONEY LINE', 'ML', 'odds_2ways', 'h2w,a2w', '', 4, 0, '2025-12-14 09:41:21', '2025-12-14 09:41:21'), - (15, 3, 'MONEY LINE', 'ML', 'odds_2ways', 'h2w,a2w', '', 4, 0, '2025-12-14 09:37:32', '2025-12-14 09:37:32'), - (22, 5, 'MONEY LINE', 'ML', 'odds_2ways', 'h2w,a2w', '', 4, 0, '2025-12-14 09:43:52', '2025-12-14 09:43:52'), - (23, 5, 'MONEY LINE SET 1', 'ML S1', 'odds_2ways_s1', 'h2w,a2w', '', 4, 0, '2025-12-14 09:44:13', '2025-12-14 09:44:13'), - (1, 1, '1X2', '1X2', 'odds_3ways', 'h3w,d3w,a3w', '', 4, 1, '2025-12-14 09:25:48', '2025-12-14 09:25:48'), - (9, 2, '1X2', '1X2', 'odds_3ways', 'h3w,d3w,a3w', '', 4, 1, '2025-12-14 09:41:34', '2025-12-14 09:41:34'), - (3, 1, '1X2 HALF TIME', '1X2 HT', 'odds_3ways_ht', 'h3w,d3w,a3w', '', 4, 1, '2025-12-14 09:25:48', '2025-12-14 09:25:48'), - (6, 1, 'DOUBLE CHANCE', 'DC', 'odds_dc', 'dc1x,dc12,dcx2', '', 4, 1, '2025-12-14 09:31:22', '2025-12-14 09:32:55'), - (8, 1, 'DRAW NO BET', 'DNB', 'odds_dnb', 'dnb1,dnb2', '', 4, 0, '2025-12-14 09:31:42', '2025-12-14 09:31:42'), - (5, 1, 'GOAL NO GOAL', 'GGNG', 'odds_ggng', 'gg,ng', '', 4, 0, '2025-12-14 09:31:56', '2025-12-14 09:31:56'), - (11, 2, 'POINTS', 'PO', 'odds_points', 'home,away', '', 4, 1, '2025-12-14 09:41:56', '2025-12-14 09:41:56'), - (16, 3, 'POINTS', 'PO', 'odds_points', 'home,away', '', 4, 1, '2025-12-14 09:38:05', '2025-12-14 09:38:05'), - (25, 5, 'POINTS', 'PO', 'odds_points', 'home,away', '', 4, 1, '2025-12-14 09:44:26', '2025-12-14 09:44:26'), - (20, 3, 'POINTS HALF TIME', 'PO HT', 'odds_points_ht', 'home,away', '', 4, 1, '2025-12-14 09:38:26', '2025-12-14 09:39:54'), - (13, 2, 'POINTS FIRST QUARTER', 'PO Q1', 'odds_points_q1', 'home,away', '', 4, 1, '2025-12-14 09:41:56', '2025-12-14 09:41:56'), - (18, 3, 'POINTS FIRST QUARTER', 'PO Q1', 'odds_points_q1', 'home,away', '', 4, 1, '2025-12-14 09:38:26', '2025-12-14 09:39:54'), - (2, 1, 'TOTALS', 'OU', 'odds_totals', 'over,under', '', 4, 1, '2025-12-14 09:32:38', '2025-12-14 09:32:38'), - (12, 2, 'TOTALS', 'OU', 'odds_totals', 'over,under', '', 4, 1, '2025-12-14 09:42:13', '2025-12-14 09:42:13'), - (17, 3, 'TOTALS', 'OU', 'odds_totals', 'over,under', '', 4, 1, '2025-12-14 09:38:44', '2025-12-14 09:38:44'), - (24, 5, 'TOTALS', 'OU', 'odds_totals', 'over,under', '', 4, 1, '2025-12-14 09:44:26', '2025-12-14 09:44:26'), - (4, 1, 'TOTALS HALF TIME', 'OU HT', 'odds_totals_ht', 'over,under', '', 4, 1, '2025-12-14 09:32:38', '2025-12-14 09:32:38'), - (21, 3, 'TOTALS HALF TIME', 'OU HT', 'odds_totals_ht', 'over,under', '', 4, 1, '2025-12-14 09:39:12', '2025-12-14 09:39:59'), - (14, 2, 'TOTALS FIRST QUARTER', 'OU Q1', 'odds_totals_q1', 'over,under', '', 4, 1, '2025-12-14 09:42:13', '2025-12-14 09:42:13'), - (19, 3, 'TOTALS FIRST QUARTER', 'OU Q1', 'odds_totals_q1', 'over,under', '', 4, 1, '2025-12-14 09:39:12', '2025-12-14 09:39:59'), - (7, 1, 'TO QUALIFY', 'TQ', 'odds_tq', 'htq,atq', '', 4, 0, '2025-12-14 09:32:19', '2025-12-14 09:32:19'); + (1, 1, '1X2', '1X2', 'odds_3ways', 'h3w,d3w,a3w', '', 4, 1, 1, '2025-12-14 09:25:48', '2026-02-22 14:26:00'), + (2, 1, 'TOTALS', 'TO', 'odds_totals', 'over,under', '', 4, 1, 3, '2025-12-14 09:32:38', '2026-02-22 14:26:00'), + (3, 1, '1X2 HALF TIME', '1X2 HT', 'odds_3ways_ht', 'h3w,d3w,a3w', '', 4, 1, 2, '2025-12-14 09:25:48', '2026-02-22 14:26:00'), + (4, 1, 'TOTALS HALF TIME', 'TO HT', 'odds_totals_ht', 'over,under', '', 4, 1, 4, '2025-12-14 09:32:38', '2026-02-22 14:26:00'), + (5, 1, 'GOAL NO GOAL', 'GGNG', 'odds_ggng', 'gg,ng', '', 4, 0, 5, '2025-12-14 09:31:56', '2026-02-22 14:26:00'), + (6, 1, 'DOUBLE CHANCE', 'DC', 'odds_dc', 'dc1x,dc12,dcx2', '', 4, 1, 6, '2025-12-14 09:31:22', '2026-02-22 14:26:00'), + (7, 1, 'TO QUALIFY', 'TQ', 'odds_tq', 'htq,atq', '', 4, 0, 7, '2025-12-14 09:32:19', '2026-02-22 14:26:00'), + (8, 1, 'DRAW NO BET', 'DNB', 'odds_dnb', 'dnb1,dnb2', '', 4, 0, 8, '2025-12-14 09:31:42', '2026-02-22 14:26:00'), + (9, 2, '1X2', '1X2', 'odds_3ways', 'h3w,d3w,a3w', '', 4, 1, 2, '2025-12-14 09:41:34', '2026-02-22 14:19:49'), + (10, 2, 'MONEY LINE', 'ML', 'odds_2ways', 'h2w,a2w', '', 4, 0, 1, '2025-12-14 09:41:21', '2026-02-22 14:19:49'), + (11, 2, 'POINTS', 'PO', 'odds_points', 'home,away', '', 4, 1, 3, '2025-12-14 09:41:56', '2026-02-22 14:19:49'), + (12, 2, 'TOTALS', 'TO', 'odds_totals', 'over,under', '', 4, 1, 5, '2025-12-14 09:42:13', '2026-02-22 14:19:49'), + (13, 2, 'POINTS FIRST QUARTER', 'PO Q1', 'odds_points_q1', 'home,away', '', 4, 1, 4, '2025-12-14 09:41:56', '2026-02-22 14:19:49'), + (14, 2, 'TOTALS FIRST QUARTER', 'TO Q1', 'odds_totals_q1', 'over,under', '', 4, 1, 6, '2025-12-14 09:42:13', '2026-02-22 14:19:49'), + (15, 3, 'MONEY LINE', 'ML', 'odds_2ways', 'h2w,a2w', '', 4, 0, 1, '2025-12-14 09:37:32', '2026-02-22 14:19:28'), + (16, 3, 'POINTS', 'PO', 'odds_points', 'home,away', '', 4, 1, 2, '2025-12-14 09:38:05', '2026-02-22 14:19:28'), + (17, 3, 'TOTALS', 'TO', 'odds_totals', 'over,under', '', 4, 1, 5, '2025-12-14 09:38:44', '2026-02-22 14:19:28'), + (18, 3, 'POINTS FIRST QUARTER', 'PO Q1', 'odds_points_q1', 'home,away', '', 4, 1, 3, '2025-12-14 09:38:26', '2026-02-22 14:19:28'), + (19, 3, 'TOTALS FIRST QUARTER', 'TO Q1', 'odds_totals_q1', 'over,under', '', 4, 1, 6, '2025-12-14 09:39:12', '2026-02-22 14:19:28'), + (20, 3, 'POINTS HALF TIME', 'PO HT', 'odds_points_ht', 'home,away', '', 4, 1, 4, '2025-12-14 09:38:26', '2026-02-22 14:19:28'), + (21, 3, 'TOTALS HALF TIME', 'TO HT', 'odds_totals_ht', 'over,under', '', 4, 1, 7, '2025-12-14 09:39:12', '2026-02-22 14:19:28'), + (22, 5, 'MONEY LINE', 'ML', 'odds_2ways', 'h2w,a2w', '', 4, 0, 1, '2025-12-14 09:43:52', '2026-02-22 14:20:00'), + (23, 5, 'MONEY LINE SET 1', 'ML S1', 'odds_2ways_s1', 'h2w,a2w', '', 4, 0, 2, '2025-12-14 09:44:13', '2026-02-22 14:20:00'), + (24, 5, 'TOTALS', 'TO', 'odds_totals', 'over,under', '', 4, 1, 4, '2025-12-14 09:44:26', '2026-02-22 14:20:00'), + (25, 5, 'POINTS', 'PO', 'odds_points', 'home,away', '', 4, 1, 3, '2025-12-14 09:44:26', '2026-02-22 14:20:00'); "; DB::unprepared($sql); diff --git a/setup.sh b/setup.sh index 309046a6..96dace3b 100755 --- a/setup.sh +++ b/setup.sh @@ -7,8 +7,15 @@ case "$1" in php artisan optimize ;; "2") - echo "DISAPLED" + echo "DISABLED" exit; + echo "" + echo "! THIS WILL TROP ALL TABLES !" + echo "" + echo "you want to do that?" + echo "10 sec to think OR" + echo "ctr+C to stop process" + sleep 15 php artisan migrate:fresh --force php artisan shield:generate --all php artisan optimize:clear