Skip to content

Commit 20ef8ca

Browse files
authored
🐛 Fix bug when no authenticate user like comment (#88)
1 parent ee7705d commit 20ef8ca

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/Http/Livewire/Discussions/Comment.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Models\Reply;
77
use Filament\Notifications\Notification;
88
use Illuminate\Contracts\View\View;
9+
use Illuminate\Support\Facades\Auth;
910
use Livewire\Component;
1011

1112
class Comment extends Component
@@ -29,6 +30,16 @@ public function delete(): void
2930

3031
public function toggleLike(): void
3132
{
33+
if (! Auth::check()) {
34+
Notification::make()
35+
->title(__('Vous devez être connecté pour liker un commentaire.'))
36+
->danger()
37+
->duration(5000)
38+
->send();
39+
40+
return;
41+
}
42+
3243
LikeReply::run(auth()->user(), $this->comment);
3344

3445
$this->emitSelf('reloadComment');

0 commit comments

Comments
 (0)