Skip to content

Commit 266c5cb

Browse files
committed
Rename Notifications component to UserNotifications to avoid conflict with Filament
1 parent ee41bd9 commit 266c5cb

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

app/Livewire/Notifications.php renamed to app/Livewire/UserNotifications.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Livewire\Component;
1111
use Livewire\WithPagination;
1212

13-
final class Notifications extends Component
13+
final class UserNotifications extends Component
1414
{
1515
use AuthorizesRequests;
1616
use WithPagination;
@@ -22,7 +22,7 @@ public function render(): View
2222
$notifications = Auth::user()->unreadNotifications()->paginate(10);
2323
$lastPage = count($notifications) == 0 ? $notifications->lastPage() : null;
2424

25-
return view('livewire.notifications', [
25+
return view('livewire.user-notifications', [
2626
'notifications' => Auth::user()->unreadNotifications()->paginate(10, ['*'], 'page', $lastPage),
2727
]);
2828
}

resources/views/users/notifications.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
@section('content')
66
<div class="container mx-auto px-4 pt-6">
7-
<livewire:notifications />
7+
<livewire:user-notifications />
88
</div>
99
@endsection

tests/Feature/NotificationsTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
use App\Livewire\Notifications;
3+
use App\Livewire\UserNotifications;
44
use App\Models\Reply;
55
use App\Models\Thread;
66
use App\Notifications\NewReplyNotification;
@@ -37,7 +37,7 @@
3737

3838
$this->loginAs($userOne);
3939

40-
Livewire::test(Notifications::class)
40+
Livewire::test(UserNotifications::class)
4141
->assertSee(new HtmlString(
4242
"A new reply was added to <a href=\"{$replyAbleRoute}\" class=\"text-lio-700\">\"{$thread->subject()}\"</a>.",
4343
));
@@ -65,7 +65,7 @@
6565

6666
$this->loginAs($userOne);
6767

68-
Livewire::test(Notifications::class)
68+
Livewire::test(UserNotifications::class)
6969
->assertSee(new HtmlString(
7070
"A new reply was added to <a href=\"{$replyAbleRoute}\" class=\"text-lio-700\">\"{$thread->subject()}\"</a>.",
7171
))
@@ -77,7 +77,7 @@
7777
});
7878

7979
test('a_non_logged_in_user_cannot_access_notifications', function () {
80-
Livewire::test(Notifications::class)->assertForbidden();
80+
Livewire::test(UserNotifications::class)->assertForbidden();
8181
});
8282

8383
test('a_user_cannot_mark_other_users_notifications_as_read', function () {
@@ -108,7 +108,7 @@
108108

109109
$this->loginAs($userTwo);
110110

111-
Livewire::test(Notifications::class)
111+
Livewire::test(UserNotifications::class)
112112
->call('markAsRead', $notification->id)
113113
->assertForbidden();
114114
});
@@ -143,7 +143,7 @@
143143

144144
$this->loginAs($userOne);
145145

146-
Livewire::test(Notifications::class)
146+
Livewire::test(UserNotifications::class)
147147
->assertSee('10');
148148
});
149149

@@ -167,13 +167,13 @@
167167

168168
$this->loginAs($userOne);
169169

170-
Livewire::test(Notifications::class)
170+
Livewire::test(UserNotifications::class)
171171
->assertSee('Clear All')
172172
->assertViewHas('notificationCount', 1);
173173

174174
post('/notifications/mark-as-read');
175175

176-
Livewire::test(Notifications::class)
176+
Livewire::test(UserNotifications::class)
177177
->assertDontSee('Clear All')
178178
->assertViewHas('notificationCount', 0);
179179
});

0 commit comments

Comments
 (0)