Skip to content

[9.x] Fix whenPivotLoaded(As) api resource methods when using Eloquent strict mode#44792

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
gdebrauwer:api-resource-pivot-loaded-with-eloquent-strict-mode-bugfix
Oct 31, 2022
Merged

[9.x] Fix whenPivotLoaded(As) api resource methods when using Eloquent strict mode#44792
taylorotwell merged 3 commits into
laravel:9.xfrom
gdebrauwer:api-resource-pivot-loaded-with-eloquent-strict-mode-bugfix

Conversation

@gdebrauwer

Copy link
Copy Markdown
Contributor

When the "Prevent accessing missing attributes on retrieved models" feature of Eloquent strict mode is enabled, the code $this->resource->$accessor will cause an unwanted exception. Using isset method fixes this.

@taylorotwell taylorotwell merged commit 4f7ee1d into laravel:9.x Oct 31, 2022
@taylorotwell

Copy link
Copy Markdown
Member

So tired of strict mode 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants