8 months ago

Laravel observer check if user is logged

Posted 8 months ago by Dronax

I have observer:


namespace App\Observers;

use App\Comment;

class CommentObserver
     * Handle the Comment "created" event.
     * @param  \App\Comment $comment
     * @return void
    public function created(Comment $comment)

I need to check if a user is logged. Can I add A user model to check if a user is logged? I need process this observe only if user is guest.

Middleware not working in observe.

In comment model:

public function boot()

Please sign in or create an account to participate in this conversation.