Hello!
When using the Spatie package spatie/laravel-activitylog, you can access all activity by Activity::all() and the latest activity by Activity::latest(), but I cant find anything in the documentation about getting activity by a causer. What I am trying to do is get the most recent (latest) activity logged by a given causer (in this case, User, but some activity is logged by events, so not all causers are of the type App\Models\User).
What I have tried in Tinker is this:
use Spatie\Activitylog\Models\Activity;
$user = App\Models\User::find(1);
$user_latest = Activity::by($user)->latest();
and:
use Spatie\Activitylog\Models\Activity;
$user = App\Models\User::find(1);
$user_latest = Activity::where('causer_type', 'App\Models\User')->where('causer_id', $user->id)->latest();
and neither of those seems to work. Does anyone know if there is a specific method for accessing logs that are causedBy` a specific model instance, like a specific user? I couldn't figure it out in the documentation, and I can't seem to figure out how to build the eloquent query.