Skip to content

Fix eloquent user type error#218

Merged
aerni merged 3 commits into
mainfrom
fix/eloquent-user-type-hint
May 6, 2026
Merged

Fix eloquent user type error#218
aerni merged 3 commits into
mainfrom
fix/eloquent-user-type-hint

Conversation

@aerni
Copy link
Copy Markdown
Owner

@aerni aerni commented May 6, 2026

Removes the Statamic\Contracts\Auth\User type hint from SeoContentGate::editContent() and the SeoSetPolicy methods that Laravel's Gate calls. With the eloquent users repository, Laravel passes the host app's Authenticatable model, which doesn't implement the contract. UserFacade::fromUser() already handles the conversion, so the hint was the only thing blocking non-super users from SEO pages.

This is the v3 regression of the original v2 fix in #110.

Fixes #108.

aerni added 3 commits May 6, 2026 10:34
When the eloquent users repository is used, Laravel's Gate dispatches
the host app's Authenticatable model (e.g. App\Models\User), which
doesn't implement Statamic\Contracts\Auth\User. UserFacade::fromUser()
already converts any Authenticatable into the contract before checks,
so the type hints just blocked non-super users from the SEO pages.

Fixes #108.
@aerni aerni changed the title Fix eloquent user type error on SEO pages Fix eloquent user type error May 6, 2026
@aerni aerni merged commit a9c83b0 into main May 6, 2026
17 checks passed
@aerni aerni deleted the fix/eloquent-user-type-hint branch May 6, 2026 08:51
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.

App\Models\User database user error when viewing setting pages.

1 participant