Skip to content

Commit 6406fce

Browse files
feat:[lar-139] undo notifications structure
1 parent 87ad15b commit 6406fce

File tree

11 files changed

+17
-35
lines changed

11 files changed

+17
-35
lines changed

app/Livewire/Pages/Notifications/Count.php renamed to app/Livewire/NotificationCount.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Livewire\Pages\Notifications;
5+
namespace App\Livewire;
66

77
use Illuminate\Contracts\View\View;
88
use Illuminate\Support\Facades\Auth;
99
use Livewire\Component;
1010

11-
final class Count extends Component
11+
final class NotificationCount extends Component
1212
{
1313
public int $count = 0;
1414

@@ -28,7 +28,7 @@ public function render(): View
2828
{
2929
$this->count = Auth::user()->unreadNotifications()->count(); // @phpstan-ignore-line
3030

31-
return view('livewire.pages.notifications.count', [
31+
return view('livewire.notification-count', [
3232
'count' => $this->count,
3333
]);
3434
}

app/Livewire/Pages/Notifications/Indicator.php renamed to app/Livewire/NotificationIndicator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Livewire\Pages\Notifications;
5+
namespace App\Livewire;
66

77
use Illuminate\Contracts\View\View;
88
use Illuminate\Support\Facades\Auth;
99
use Livewire\Attributes\On;
1010
use Livewire\Component;
1111

12-
final class Indicator extends Component
12+
final class NotificationIndicator extends Component
1313
{
1414
public bool $hasNotification = false;
1515

@@ -25,7 +25,7 @@ public function render(): View
2525
Auth::user()->unreadNotifications()->count(), // @phpstan-ignore-line
2626
);
2727

28-
return view('livewire.pages.notifications.indicator', [
28+
return view('livewire.notification-indicator', [
2929
'hasNotification' => $this->hasNotification,
3030
]);
3131
}

app/Livewire/Pages/Notifications/Page.php renamed to app/Livewire/NotificationPage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Livewire\Pages\Notifications;
5+
namespace App\Livewire;
66

77
use App\Policies\NotificationPolicy;
88
use Carbon\Carbon;
@@ -13,7 +13,7 @@
1313
use Illuminate\Support\Facades\Auth;
1414
use Livewire\Component;
1515

16-
final class Page extends Component
16+
final class NotificationPage extends Component
1717
{
1818
use AuthorizesRequests;
1919

@@ -48,7 +48,7 @@ public function markAsRead(string $notificationId): void
4848

4949
public function render(): View
5050
{
51-
return view('livewire.pages.notifications.page', [
51+
return view('livewire.notification-page', [
5252
// @phpstan-ignore-next-line
5353
'notifications' => Auth::user()
5454
->unreadNotifications()

app/Livewire/Pages/Notifications/Index.php renamed to app/Livewire/Pages/Notifications.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Livewire\Pages\Notifications;
5+
namespace App\Livewire\Pages;
66

77
use Illuminate\Contracts\View\View;
88
use Livewire\Component;
99

10-
final class Index extends Component
10+
final class Notifications extends Component
1111
{
1212
public function render(): View
1313
{
14-
return view('livewire.pages.notifications.index');
14+
return view('livewire.pages.notifications');
1515
}
1616
}

resources/views/components/layouts/header.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<x-slot:title>
3232
<span class="sr-only">{{ __('global.view_notifications') }}</span>
3333
<x-untitledui-bell class="size-5" aria-hidden="true" />
34-
<livewire:pages.notifications.indicator />
34+
<livewire:notification-indicator />
3535
</x-slot:title>
3636
</x-nav.item>
3737

resources/views/livewire/pages/notifications/index.blade.php renamed to resources/views/livewire/pages/notifications.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<h2
77
class="inline-flex items-center gap-x-2 font-heading text-xl font-bold leading-7 text-gray-900 dark:text-white sm:truncate sm:text-2xl"
88
>
9-
{{ __('Notifications') }}
10-
<livewire:pages.notifications.count />
9+
Notifications
10+
<livewire:notification-count />
1111
</h2>
1212
</div>
1313

1414
<section class="relative mt-8">
15-
<livewire:pages.notifications.page />
15+
<livewire:notification-page />
1616
</section>
1717
</x-container>
1818
</div>

resources/views/user/notifications.blade.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
Route::get('subscribeable/{id}/{type}', [SubscriptionController::class, 'redirect'])->name('subscriptions.redirect');
4545

4646
// Notifications
47-
Route::get('notifications', App\Livewire\Pages\Notifications\Index::class)
47+
Route::get('notifications', \App\Livewire\Pages\Notifications::class)
4848
->name('notifications')
4949
->middleware(['auth', 'checkIfBanned']);
5050

0 commit comments

Comments
 (0)