Skip to content

Commit 9942175

Browse files
committed
Related model.
1 parent fa420f8 commit 9942175

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Fields/EagerField.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public function resolve($repository, $attribute = null)
5757
->allowToShow(app(Request::class))
5858
->eagerState();
5959
} catch (AuthorizationException $e) {
60+
if(is_null($relatedModel)) {
61+
abort(403, "Related model is null.");
62+
}
63+
6064
$class = get_class($relatedModel);
6165
$field = class_basename(get_called_class());
6266
$policy = get_class(Gate::getPolicyFor($relatedModel));

0 commit comments

Comments
 (0)