Skip to content

Commit 4255e33

Browse files
committed
My notifications page
1 parent 6319f8e commit 4255e33

28 files changed

Lines changed: 327 additions & 37 deletions

app/Http/Livewire/Auth/ForgotPassword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function forgotPassword(): void
5858
if ($status === PasswordFacade::RESET_LINK_SENT) {
5959
Notification::make()
6060
->success()
61-
->title('Success')
61+
->title(__('Success'))
6262
->body(__('A password recovery email has been sent'))
6363
->send();
6464
$this->form->fill();

app/Http/Livewire/Auth/Login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function render()
3434
if (session()->get('password_reset')) {
3535
Notification::make()
3636
->success()
37-
->title('Success')
37+
->title(__('Success'))
3838
->body(__('Your password is now updated'))
3939
->send();
4040
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace App\Http\Livewire;
4+
5+
use Filament\Notifications\Notification;
6+
use Livewire\Component;
7+
8+
class MyNotifications extends Component
9+
{
10+
11+
public function render()
12+
{
13+
$notifications = auth()->user()->notifications()->orderBy('created_at', 'desc')->paginate();
14+
return view('livewire.my-notifications', compact('notifications'));
15+
}
16+
17+
/**
18+
* Mark a notification as read
19+
*
20+
* @param string $notification
21+
* @return void
22+
*/
23+
public function markRead(string $notification): void
24+
{
25+
auth()->user()->notifications()->where('id', $notification)->update([
26+
'read_at' => now()
27+
]);
28+
Notification::make()
29+
->success()
30+
->title(__('Notification updated'))
31+
->body(__('The notification is now marked as read'))
32+
->send();
33+
}
34+
35+
/**
36+
* Mark all unread notifications as read
37+
*
38+
* @return void
39+
*/
40+
public function markAllRead(): void
41+
{
42+
auth()->user()->unreadNotifications()->update(['read_at' => now()]);
43+
Notification::make()
44+
->success()
45+
->title(__('Notifications updated'))
46+
->body(__('All unread notifications is not marked as read'))
47+
->send();
48+
}
49+
}

app/Http/Livewire/MyProfile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private function initProfile(): void
4747
if (session()->has('profile_updated')) {
4848
Notification::make()
4949
->success()
50-
->title('Profile updated')
50+
->title(__('Profile updated'))
5151
->body(__('Your account details has been updated'))
5252
->send();
5353
}

app/Http/Livewire/Projects.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function toggleFavoriteProject(Project $project) {
140140
FavoriteProject::where('user_id', auth()->user()->id)->where('project_id', $project->id)->delete();
141141
Notification::make()
142142
->success()
143-
->title('Favorite removed')
143+
->title(__('Favorite removed'))
144144
->body(__('The project has been successfully remove from your favorite projects'))
145145
->send();
146146
} else {
@@ -150,7 +150,7 @@ public function toggleFavoriteProject(Project $project) {
150150
]);
151151
Notification::make()
152152
->success()
153-
->title('Favorite added')
153+
->title(__('Favorite added'))
154154
->body(__('The project has been successfully added to your favorite projects'))
155155
->send();
156156
}

app/Http/Livewire/ProjectsDialog.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function save(): void {
7878
]);
7979
Notification::make()
8080
->success()
81-
->title('Project created')
81+
->title(__('Project created'))
8282
->body(__('The project has been successfully created'))
8383
->send();
8484
} else {
@@ -88,7 +88,7 @@ public function save(): void {
8888
$this->project->save();
8989
Notification::make()
9090
->success()
91-
->title('Project updated')
91+
->title(__('Project updated'))
9292
->body(__('The project\'s details has been updated'))
9393
->send();
9494
}
@@ -106,7 +106,7 @@ public function doDeleteProject(): void {
106106
$this->emit('projectDeleted');
107107
Notification::make()
108108
->success()
109-
->title('Project deleted')
109+
->title(__('Project deleted'))
110110
->body(__('The project has been deleted'))
111111
->send();
112112
}
@@ -130,7 +130,7 @@ public function deleteProject(): void {
130130
$this->deleteConfirmationOpened = true;
131131
Notification::make()
132132
->warning()
133-
->title('Project deletion')
133+
->title(__('Project deletion'))
134134
->body(__('Are you sure you want to delete this project?'))
135135
->actions([
136136
Action::make('confirm')

app/Http/Livewire/TicketDetails/Content.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function save(): void
7171
$this->ticket->save();
7272
Notification::make()
7373
->success()
74-
->title('Content updated')
74+
->title(__('Content updated'))
7575
->body(__('The ticket content has been successfully updated'))
7676
->send();
7777
$this->form->fill([

app/Http/Livewire/TicketDetails/Priority.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function save(): void
7171
$this->ticket->save();
7272
Notification::make()
7373
->success()
74-
->title('Priority updated')
74+
->title(__('Priority updated'))
7575
->body(__('The ticket priority has been successfully updated'))
7676
->send();
7777
$this->form->fill([

app/Http/Livewire/TicketDetails/Responsible.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function save(): void
7171
$this->ticket->save();
7272
Notification::make()
7373
->success()
74-
->title('Responsible updated')
74+
->title(__('Responsible updated'))
7575
->body(__('The ticket responsible has been successfully updated'))
7676
->send();
7777
$this->form->fill([

app/Http/Livewire/TicketDetails/Status.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function save(): void
7070
$this->ticket->save();
7171
Notification::make()
7272
->success()
73-
->title('Status updated')
73+
->title(__('Status updated'))
7474
->body(__('The ticket status has been successfully updated'))
7575
->send();
7676
$this->form->fill([

0 commit comments

Comments
 (0)