shetabit/visitor

How to solve Call to undefined method App\Models\User::online() error

Wesley-Sinde opened this issue · 4 comments

Detailed description

I am new to shetabit/visitor, i was trying set it up today to see how good its is. I have a small issue or big, when i want to check users online i get an error.

BadMethodCallException
Call to undefined method App\Models\User::online()

Someone to help what might be the issue here

My environment

Include as many relevant details about the environment you experienced the bug in and how to reproduce it.

  • PHP 8
  • laravel 9

use the related trait in the user model. see docs.

I'm getting the same error, and I'm using the trait.

BadMethodCallException
Call to undefined method App\Models\User::online()

use HasApiTokens, HasFactory, Notifiable, SoftDeletes, Visitable;

@Van4kk see the below files:

https://github.com/shetabit/visitor/blob/master/src/Traits/CanVisit.php
https://github.com/shetabit/visitor/blob/master/src/Traits/Visitor.php

you should use the shetabit\Visitor\Traits\Visitor trait in the user class.

read the docs before using the package.

ight, thanks ❤️