Skip to content

Commit 846c522

Browse files
committed
bugfix.
1 parent b2eb33b commit 846c522

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Followable.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ public function attachFollowStatus($followables, callable $resolver = null)
214214

215215
$followed = $this->followings()->wherePivot('accepted_at', '!=', null)->pluck('following_id');
216216

217-
$followables->map(function (Model $followable) use ($followed, $resolver) {
217+
$followables->map(function ($followable) use ($followed, $resolver) {
218218
$resolver = $resolver ?? fn ($m) => $m;
219219
$followable = $resolver($followable);
220220

221-
if (\in_array(Followable::class, \class_uses($followable))) {
221+
if ($followable && \in_array(Followable::class, \class_uses($followable))) {
222222
$followable->setAttribute('has_followed', $followed->contains($followable->getKey()));
223223
}
224224
});

0 commit comments

Comments
 (0)