Skip to content
This repository has been archived by the owner on Jun 1, 2019. It is now read-only.

Problem with fetching activity log #12

Closed
webmastervinay opened this issue Jul 15, 2015 · 3 comments
Closed

Problem with fetching activity log #12

webmastervinay opened this issue Jul 15, 2015 · 3 comments

Comments

@webmastervinay
Copy link

Hello,

I am able to store the activity log without any issue. But when i am trying to fetch it by following lines

$latestActivities = Activity::with('user')->latest()->limit(100)->get();

I am getting issue as below:

Call to undefined method Spatie\Activitylog\ActivitylogSupervisor::with()

Can you please help??

@freekmurze
Copy link
Member

You should import the activty-model instead of the facade.

Make sure you have

use Spatie\Activitylog\Models\Activity;

at the top of your file.

@webmastervinay
Copy link
Author

Hello,

I am using it in UserController. I put use Spatie\Activitylog\Models\Activity it in very first line and now it is fetching the records in one of the function.

But now the Activity::log('logged out'); which is also in same UserController (logout method) is not working. It shows Call to undefined method Illuminate\Database\Query\Builder::log().

Both are not working in same controller.

@freekmurze
Copy link
Member

When importing two objects with the same name from different namespaces you should alias one of the two.

More info: http://php.net/manual/en/language.namespaces.importing.php

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants