Skip to content

Commit

Permalink
🐛 Fix bug when no authenticate user like comment (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
mckenziearts authored Mar 13, 2023
1 parent ee7705d commit 20ef8ca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Http/Livewire/Discussions/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\Reply;
use Filament\Notifications\Notification;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;

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

public function toggleLike(): void
{
if (! Auth::check()) {
Notification::make()
->title(__('Vous devez être connecté pour liker un commentaire.'))
->danger()
->duration(5000)
->send();

return;
}

LikeReply::run(auth()->user(), $this->comment);

$this->emitSelf('reloadComment');
Expand Down

0 comments on commit 20ef8ca

Please sign in to comment.