diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 99071d7e..1b639cab 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -77,10 +77,12 @@ protected function hierarchy(): Attribute CommentHierarchy SQL; - return new Attribute( + $attribute = new Attribute( get: fn ($value) => Arr::first( DB::select($query, ['id' => $this->id]) ) - )->shouldCache(); + ); + + return $attribute->shouldCache(); } } diff --git a/app/Models/User.php b/app/Models/User.php index d3c5b7bc..2b5d7d8b 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -81,9 +81,11 @@ public function notifyNewComment(NewComment $instance): void protected function gravatarUrl(): Attribute { - return new Attribute( + $attribute = new Attribute( get: fn ($value) => get_gravatar(email: $this->email, size: 512) - )->shouldCache(); + ); + + return $attribute->shouldCache(); } public function passkeys(): MorphMany diff --git "a/resources/views/components/layouts/\342\232\241header.blade.php" "b/resources/views/components/layouts/\342\232\241header.blade.php" index 8284cc54..f0d68283 100644 --- "a/resources/views/components/layouts/\342\232\241header.blade.php" +++ "b/resources/views/components/layouts/\342\232\241header.blade.php" @@ -55,6 +55,10 @@ public function logout(Logout $logout): void @endscript +@php + $hasUnreadNotifications = auth()->check() && auth()->user()->unreadNotifications()->exists(); +@endphp +