diff --git a/app/Http/Controllers/Api/Auth/RegisterController.php b/app/Http/Controllers/Api/Auth/RegisterController.php index 324b787d..be359ca9 100644 --- a/app/Http/Controllers/Api/Auth/RegisterController.php +++ b/app/Http/Controllers/Api/Auth/RegisterController.php @@ -31,7 +31,7 @@ public function register(RegisterRequest $request): JsonResponse $user->assignRole('company'); - //TODO: Send new company registration notification on Slack + // TODO: Send new company registration notification on Slack event(new ApiRegistered($user)); return response()->json( @@ -81,9 +81,9 @@ public function googleAuthenticator(Request $request): JsonResponse 'avatar' => $socialUser['photoUrl'], ]); - //TODO: Send welcome email to user 1 hour after registration + // TODO: Send welcome email to user 1 hour after registration - //TODO: Send new company registration notification on Slack + // TODO: Send new company registration notification on Slack $user->last_login_at = Carbon::now(); $user->last_login_ip = $request->ip(); diff --git a/app/Livewire/Pages/Forum/Index.php b/app/Livewire/Pages/Forum/Index.php index 14ec2378..2578af6c 100644 --- a/app/Livewire/Pages/Forum/Index.php +++ b/app/Livewire/Pages/Forum/Index.php @@ -36,7 +36,7 @@ final class Index extends Component #[Url(as: 'no-replies')] public ?string $unAnswered = null; - #[Url] + #[Url(as: 'follow')] public ?string $subscribe = null; public ?Channel $currentChannel = null; @@ -129,6 +129,12 @@ protected function applyChannel(Builder $query): Builder protected function applySubscribe(Builder $query): Builder { + if (Auth::check() && $this->subscribe) { + $query->whereHas('subscribes', function (Builder $query): void { + $query->where('user_id', Auth::id()); + }); + } + return $query; } diff --git a/app/Models/User.php b/app/Models/User.php index 9ab40437..c57646a5 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -477,10 +477,8 @@ public function scopeWithCounts(Builder $query): Builder 'articles as articles_count', 'threads as threads_count', 'replyAble as replies_count', - 'replyAble as solutions_count' => function (Builder $query) { - return $query->join('threads', 'threads.solution_reply_id', '=', 'replies.id') - ->where('replyable_type', 'thread'); - }, + 'replyAble as solutions_count' => fn (Builder $query) => $query->join('threads', 'threads.solution_reply_id', '=', 'replies.id') + ->where('replyable_type', 'thread'), ]); } diff --git a/app/Widgets/MostActiveUsersPerWeek.php b/app/Widgets/MostActiveUsersPerWeek.php index 7d37dffc..467b5ea7 100644 --- a/app/Widgets/MostActiveUsersPerWeek.php +++ b/app/Widgets/MostActiveUsersPerWeek.php @@ -33,12 +33,10 @@ public function run(): View $users = User::with('activities') ->withCount('activities') ->verifiedUsers() - ->whereHas('activities', function (Builder $query) { - return $query->whereBetween('created_at', [ - now()->startOfWeek(), - now()->endOfWeek(), - ]); - }) + ->whereHas('activities', fn (Builder $query) => $query->whereBetween('created_at', [ + now()->startOfWeek(), + now()->endOfWeek(), + ])) ->orderByDesc('activities_count') ->limit(5) ->get(); diff --git a/composer.lock b/composer.lock index d2a35e46..2f13f04e 100644 --- a/composer.lock +++ b/composer.lock @@ -2510,16 +2510,16 @@ }, { "name": "egulias/email-validator", - "version": "4.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e" + "reference": "b115554301161fa21467629f1e1391c1936de517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ebaaf5be6c0286928352e054f2d5125608e5405e", - "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/b115554301161fa21467629f1e1391c1936de517", + "reference": "b115554301161fa21467629f1e1391c1936de517", "shasum": "" }, "require": { @@ -2565,7 +2565,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.2" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.3" }, "funding": [ { @@ -2573,7 +2573,7 @@ "type": "github" } ], - "time": "2023-10-06T06:47:41+00:00" + "time": "2024-12-27T00:36:43+00:00" }, { "name": "filament/actions", @@ -5234,16 +5234,16 @@ }, { "name": "league/commonmark", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "d150f911e0079e90ae3c106734c93137c184f932" + "reference": "d990688c91cedfb69753ffc2512727ec646df2ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d150f911e0079e90ae3c106734c93137c184f932", - "reference": "d150f911e0079e90ae3c106734c93137c184f932", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d990688c91cedfb69753ffc2512727ec646df2ad", + "reference": "d990688c91cedfb69753ffc2512727ec646df2ad", "shasum": "" }, "require": { @@ -5337,7 +5337,7 @@ "type": "tidelift" } ], - "time": "2024-12-07T15:34:16+00:00" + "time": "2024-12-29T14:10:59+00:00" }, { "name": "league/config", @@ -6584,16 +6584,16 @@ }, { "name": "nesbot/carbon", - "version": "3.8.3", + "version": "3.8.4", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "f01cfa96468f4c38325f507ab81a4f1d2cd93cfe" + "reference": "129700ed449b1f02d70272d2ac802357c8c30c58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f01cfa96468f4c38325f507ab81a4f1d2cd93cfe", - "reference": "f01cfa96468f4c38325f507ab81a4f1d2cd93cfe", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/129700ed449b1f02d70272d2ac802357c8c30c58", + "reference": "129700ed449b1f02d70272d2ac802357c8c30c58", "shasum": "" }, "require": { @@ -6686,7 +6686,7 @@ "type": "tidelift" } ], - "time": "2024-12-21T18:03:19+00:00" + "time": "2024-12-27T09:25:35+00:00" }, { "name": "nette/schema", @@ -6892,16 +6892,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -6944,9 +6944,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "notchpay/notchpay-php", @@ -7874,16 +7874,16 @@ }, { "name": "propaganistas/laravel-phone", - "version": "5.3.2", + "version": "5.3.3", "source": { "type": "git", "url": "https://github.com/Propaganistas/Laravel-Phone.git", - "reference": "44efd6edc181616c49f895fff97ad1cc0f3fecb2" + "reference": "2172362ae5714ddc397d9df96a44b82bd125631a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Propaganistas/Laravel-Phone/zipball/44efd6edc181616c49f895fff97ad1cc0f3fecb2", - "reference": "44efd6edc181616c49f895fff97ad1cc0f3fecb2", + "url": "https://api.github.com/repos/Propaganistas/Laravel-Phone/zipball/2172362ae5714ddc397d9df96a44b82bd125631a", + "reference": "2172362ae5714ddc397d9df96a44b82bd125631a", "shasum": "" }, "require": { @@ -7894,7 +7894,6 @@ "php": "^8.1" }, "require-dev": { - "larastan/larastan": "^2.9", "laravel/pint": "^1.14", "orchestra/testbench": "*", "phpunit/phpunit": "^10.5" @@ -7934,7 +7933,7 @@ ], "support": { "issues": "https://github.com/Propaganistas/Laravel-Phone/issues", - "source": "https://github.com/Propaganistas/Laravel-Phone/tree/5.3.2" + "source": "https://github.com/Propaganistas/Laravel-Phone/tree/5.3.3" }, "funding": [ { @@ -7942,7 +7941,7 @@ "type": "github" } ], - "time": "2024-04-24T09:18:58+00:00" + "time": "2024-12-27T11:45:47+00:00" }, { "name": "psr/cache", @@ -9110,16 +9109,16 @@ }, { "name": "spatie/browsershot", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/spatie/browsershot.git", - "reference": "aae8a337f73f63fc41c4c759fc397ce725312367" + "reference": "c0fa14c2386df2b4444e803ddc11e592b16d3a20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/browsershot/zipball/aae8a337f73f63fc41c4c759fc397ce725312367", - "reference": "aae8a337f73f63fc41c4c759fc397ce725312367", + "url": "https://api.github.com/repos/spatie/browsershot/zipball/c0fa14c2386df2b4444e803ddc11e592b16d3a20", + "reference": "c0fa14c2386df2b4444e803ddc11e592b16d3a20", "shasum": "" }, "require": { @@ -9166,7 +9165,7 @@ "webpage" ], "support": { - "source": "https://github.com/spatie/browsershot/tree/5.0.3" + "source": "https://github.com/spatie/browsershot/tree/5.0.5" }, "funding": [ { @@ -9174,20 +9173,20 @@ "type": "github" } ], - "time": "2024-12-16T09:46:16+00:00" + "time": "2024-12-30T12:56:36+00:00" }, { "name": "spatie/color", - "version": "1.6.3", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/spatie/color.git", - "reference": "45c4354ffa7e65f05c502b009834ecac7928daa3" + "reference": "614f1e0674262c620db908998a11eacd16494835" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/color/zipball/45c4354ffa7e65f05c502b009834ecac7928daa3", - "reference": "45c4354ffa7e65f05c502b009834ecac7928daa3", + "url": "https://api.github.com/repos/spatie/color/zipball/614f1e0674262c620db908998a11eacd16494835", + "reference": "614f1e0674262c620db908998a11eacd16494835", "shasum": "" }, "require": { @@ -9225,7 +9224,7 @@ ], "support": { "issues": "https://github.com/spatie/color/issues", - "source": "https://github.com/spatie/color/tree/1.6.3" + "source": "https://github.com/spatie/color/tree/1.7.0" }, "funding": [ { @@ -9233,7 +9232,7 @@ "type": "github" } ], - "time": "2024-12-23T11:00:34+00:00" + "time": "2024-12-30T14:23:15+00:00" }, { "name": "spatie/crawler", @@ -9824,16 +9823,16 @@ }, { "name": "spatie/laravel-medialibrary", - "version": "11.11.0", + "version": "11.11.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-medialibrary.git", - "reference": "fe3f17e8e5be30b056bd9fcc610e975d8199e154" + "reference": "1c4950237a5f2876102b36ded89a00bb6ea96c09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/fe3f17e8e5be30b056bd9fcc610e975d8199e154", - "reference": "fe3f17e8e5be30b056bd9fcc610e975d8199e154", + "url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/1c4950237a5f2876102b36ded89a00bb6ea96c09", + "reference": "1c4950237a5f2876102b36ded89a00bb6ea96c09", "shasum": "" }, "require": { @@ -9917,7 +9916,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-medialibrary/issues", - "source": "https://github.com/spatie/laravel-medialibrary/tree/11.11.0" + "source": "https://github.com/spatie/laravel-medialibrary/tree/11.11.1" }, "funding": [ { @@ -9929,20 +9928,20 @@ "type": "github" } ], - "time": "2024-12-09T16:19:56+00:00" + "time": "2024-12-30T10:16:02+00:00" }, { "name": "spatie/laravel-package-tools", - "version": "1.17.0", + "version": "1.18.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "9ab30fd24f677e5aa370ea4cf6b41c517d16cf85" + "reference": "8332205b90d17164913244f4a8e13ab7e6761d29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/9ab30fd24f677e5aa370ea4cf6b41c517d16cf85", - "reference": "9ab30fd24f677e5aa370ea4cf6b41c517d16cf85", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/8332205b90d17164913244f4a8e13ab7e6761d29", + "reference": "8332205b90d17164913244f4a8e13ab7e6761d29", "shasum": "" }, "require": { @@ -9981,7 +9980,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.17.0" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.18.0" }, "funding": [ { @@ -9989,7 +9988,7 @@ "type": "github" } ], - "time": "2024-12-09T16:29:14+00:00" + "time": "2024-12-30T13:13:39+00:00" }, { "name": "spatie/laravel-permission", @@ -10149,16 +10148,16 @@ }, { "name": "spatie/laravel-sluggable", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-sluggable.git", - "reference": "23dcb4cb9306f235a1eb20f170978afde82d0221" + "reference": "cfe8440ebce367b66bdfec6e1a7c8e33879092fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-sluggable/zipball/23dcb4cb9306f235a1eb20f170978afde82d0221", - "reference": "23dcb4cb9306f235a1eb20f170978afde82d0221", + "url": "https://api.github.com/repos/spatie/laravel-sluggable/zipball/cfe8440ebce367b66bdfec6e1a7c8e33879092fc", + "reference": "cfe8440ebce367b66bdfec6e1a7c8e33879092fc", "shasum": "" }, "require": { @@ -10196,7 +10195,7 @@ "spatie" ], "support": { - "source": "https://github.com/spatie/laravel-sluggable/tree/3.7.1" + "source": "https://github.com/spatie/laravel-sluggable/tree/3.7.2" }, "funding": [ { @@ -10204,7 +10203,7 @@ "type": "github" } ], - "time": "2024-12-23T09:54:10+00:00" + "time": "2024-12-30T09:06:04+00:00" }, { "name": "spatie/laravel-translatable", @@ -10810,12 +10809,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -11100,12 +11099,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -12839,12 +12838,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -13099,12 +13098,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -14403,16 +14402,16 @@ }, { "name": "laravel/pint", - "version": "v1.18.3", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "cef51821608239040ab841ad6e1c6ae502ae3026" + "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/cef51821608239040ab841ad6e1c6ae502ae3026", - "reference": "cef51821608239040ab841ad6e1c6ae502ae3026", + "url": "https://api.github.com/repos/laravel/pint/zipball/8169513746e1bac70c85d6ea1524d9225d4886f0", + "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0", "shasum": "" }, "require": { @@ -14423,10 +14422,10 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.65.0", - "illuminate/view": "^10.48.24", - "larastan/larastan": "^2.9.11", - "laravel-zero/framework": "^10.4.0", + "friendsofphp/php-cs-fixer": "^3.66.0", + "illuminate/view": "^10.48.25", + "larastan/larastan": "^2.9.12", + "laravel-zero/framework": "^10.48.25", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.17.0", "pestphp/pest": "^2.36.0" @@ -14465,7 +14464,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-11-26T15:34:00+00:00" + "time": "2024-12-30T16:20:10+00:00" }, { "name": "mockery/mockery", diff --git a/config/permission.php b/config/permission.php index 18e8bfac..8298e3a8 100644 --- a/config/permission.php +++ b/config/permission.php @@ -77,8 +77,8 @@ /* * Change this if you want to name the related pivots other than defaults */ - 'role_pivot_key' => null, //default 'role_id', - 'permission_pivot_key' => null, //default 'permission_id', + 'role_pivot_key' => null, // default 'role_id', + 'permission_pivot_key' => null, // default 'permission_id', /* * Change this if you want to name the related model primary key other than diff --git a/database/factories/ArticleFactory.php b/database/factories/ArticleFactory.php index 94da615f..bc092f52 100644 --- a/database/factories/ArticleFactory.php +++ b/database/factories/ArticleFactory.php @@ -25,22 +25,18 @@ public function definition(): array public function approved(): self { - return $this->state(function (array $attributes): array { - return [ - 'published_at' => now()->addDays(2), - 'submitted_at' => now(), - 'approved_at' => now(), - ]; - }); + return $this->state(fn (array $attributes): array => [ + 'published_at' => now()->addDays(2), + 'submitted_at' => now(), + 'approved_at' => now(), + ]); } public function submitted(): self { - return $this->state(function (array $attributes): array { - return [ - 'submitted_at' => now(), - 'published_at' => now()->addDay(), - ]; - }); + return $this->state(fn (array $attributes): array => [ + 'submitted_at' => now(), + 'published_at' => now()->addDay(), + ]); } } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 6f47cea9..394f2f8f 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -26,39 +26,31 @@ public function definition(): array public function unverified(): self { - return $this->state(function (array $attributes) { - return [ - 'email_verified_at' => null, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'email_verified_at' => null, + ]); } public function lastMonth(): self { - return $this->state(function (array $attributes) { - return [ - 'created_at' => now()->subMonth(), - ]; - }); + return $this->state(fn (array $attributes) => [ + 'created_at' => now()->subMonth(), + ]); } public function banned(): self { - return $this->state(function (array $attributes) { - return [ - 'banned_at' => now(), - 'banned_reason' => 'Violation des règles de la communauté', - ]; - }); + return $this->state(fn (array $attributes) => [ + 'banned_at' => now(), + 'banned_reason' => 'Violation des règles de la communauté', + ]); } public function unbanned(): self { - return $this->state(function (array $attributes) { - return [ - 'banned_at' => null, - 'banned_reason' => null, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'banned_at' => null, + 'banned_reason' => null, + ]); } }