diff --git a/src/Http/Controllers/Admin/DashboardController.php b/src/Http/Controllers/Admin/DashboardController.php index d6788c78b..2aab4b773 100644 --- a/src/Http/Controllers/Admin/DashboardController.php +++ b/src/Http/Controllers/Admin/DashboardController.php @@ -233,6 +233,10 @@ private function getLoggedInUserActivities(): LengthAwarePaginator private function formatActivity(Activity $activity): ?array { + if (is_null($activity->subject)) { + return null; + } + if ($activity->subject_type === config('twill.auth_activity_causer', 'users')) { return $this->formatAuthActivity($activity); } @@ -243,10 +247,6 @@ private function formatActivity(Activity $activity): ?array return null; } - if (is_null($activity->subject)) { - return null; - } - if (auth('twill_users')->user()->cannot('view-item', $activity->subject)) { return null; }