Skip to content

Commit d1da46c

Browse files
committed
Fix incorrect API definitions
1 parent 2a2fc42 commit d1da46c

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

app/Http/Controllers/Api/Client/ActivityLogController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function __invoke(ClientApiRequest $request): array
2020
AllowedFilter::exact('ip'),
2121
AllowedFilter::partial('event'),
2222
])
23+
->allowedSorts(['timestamp'])
2324
->paginate(min($request->query('per_page', 50), 100))
2425
->appends($request->query());
2526

app/Models/ActivityLog.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ class ActivityLog extends Model
7373

7474
public function actor(): MorphTo
7575
{
76-
return $this->morphTo()->withTrashed();
76+
$morph = $this->morphTo();
77+
if (method_exists($morph, 'withTrashed')) {
78+
return $morph->withTrashed();
79+
}
80+
81+
return $morph;
7782
}
7883

7984
public function subjects()

app/Models/ActivityLogSubject.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public function activityLog()
3535

3636
public function subject()
3737
{
38-
return $this->morphTo()->withTrashed();
38+
$morph = $this->morphTo();
39+
if (method_exists($morph, 'withTrashed')) {
40+
return $morph->withTrashed();
41+
}
42+
43+
return $morph;
3944
}
4045
}

0 commit comments

Comments
 (0)