PHPLARA-133: Add support for Laravel 13 attributes - #3565
Open
paulinevos wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds coverage (and a small runtime adjustment) to ensure MongoDB Eloquent models correctly honor Laravel’s new Eloquent PHP attributes (as introduced upstream for Laravel 13), including behavior when using the DocumentModel trait.
Changes:
- Added a comprehensive
ModelAttributesTestexercising#[Table],#[Connection],#[Fillable],#[Hidden],#[Visible],#[Guarded],#[Unguarded],#[Appends],#[Touches], and factory attributes. - Introduced a set of minimal attributed test models/factory used by the new test suite.
- Updated
DocumentModelto apply#[Table(..., keyType: ...)]tokeyTypewhen the property hasn’t been explicitly overridden by user code.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Models/AttributedVisibleDocument.php | Adds a model using #[Visible] for test coverage. |
| tests/Models/AttributedUnguardedDocument.php | Adds a model using #[Unguarded] for test coverage. |
| tests/Models/AttributedTraitDocument.php | Adds an Eloquent base model using DocumentModel + #[Table] for trait coverage. |
| tests/Models/AttributedIntegerKeyDocument.php | Adds a model using #[Table(..., keyType: 'int')] for key-type coverage. |
| tests/Models/AttributedGuardedDocument.php | Adds a model using #[Guarded] for test coverage. |
| tests/Models/AttributedDocumentFactory.php | Adds a factory using #[UseModel] to verify factory/model attribute wiring. |
| tests/Models/AttributedDocument.php | Adds a model exercising multiple Laravel attributes end-to-end. |
| tests/Models/AttributedDeclaredKeyTypeDocument.php | Adds a model ensuring $keyType property overrides the attribute. |
| tests/Models/AttributedAuthor.php | Adds a related model for #[Touches] behavior verification. |
| tests/Eloquent/ModelAttributesTest.php | New test suite validating Laravel attribute behavior against MongoDB models. |
| src/Eloquent/DocumentModel.php | Ensures keyType can be derived from #[Table] when not explicitly overridden. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ensures support for the new attributes added to Laravel in this PR: laravel/framework#58578 by adding passing tests for them
GromNaN
approved these changes
Aug 13, 2026
Member
|
If I understand correctly, only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensures support for the new attributes added to Laravel in this PR: laravel/framework#58578 by adding passing tests for them
Checklist