passign custom model to tapActivity throws: instance of Spatie\Activitylog\Models\Activity given #1037
Unanswered
diptigajjar
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I'm pretty sure that you haven't configured your custom model in the package config - that's why the packages creates an instance of the default model. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I've implemented the laravel-activitylog in my project and have extended the Activity Model in my custom Model UserActivityLog. But when I pass the UserActivityLog model to tapActivity function then it throws below error.
Argument 1 passed to App\User::tapActivity() must be an instance of App\UserActivityLog, instance of Spatie\Activitylog\Models\Activity given
UserActivityLog model:
class UserActivityLog extends Activity implements ActivityContract{
// code to list the activity
}
tapActivity:
public function tapActivity(UserActivityLog $activity, string $eventName)
{
}
What causes this error?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions