fix: support $guarded models and MariaDB driver [3.x]#124
Merged
ManukMinasyan merged 2 commits into3.xfrom Mar 23, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses two compatibility gaps in the custom-fields package: (1) enabling mass-assignment of custom_fields for models that rely on $guarded instead of $fillable, and (2) explicitly supporting Laravel’s mariadb database driver in driver-specific constraints.
Changes:
- Update
UsesCustomFieldsto addcustom_fieldsto fillable when$guardedis non-empty. - Add
mariadbto thetext_valuedriver-specific maximum constraints (matching MySQL at 65535). - Add Pest tests covering MariaDB constraints and guarded-model fill behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Models/Concerns/UsesCustomFields.php |
Adjusts when custom_fields is merged into $fillable to support guarded models. |
src/Support/DatabaseFieldConstraints.php |
Adds explicit mariadb max length for text_value. |
tests/Feature/Models/GuardedModelCustomFieldsTest.php |
Adds tests for guarded-model custom_fields fillability. |
tests/Feature/Support/DatabaseFieldConstraintsTest.php |
Adds tests verifying MariaDB is present and has the expected max. |
f362c9a to
f168945
Compare
f168945 to
90d4aca
Compare
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.
Summary
$guardedinstead of$fillablecouldn't save custom fields. ReplacemergeFillablewithisFillable()andfillableFromArray()overrides.text_valuedriver-specific constraints (matches MySQL at 65535).Closes #121
Closes #120
Test plan
custom_fieldsas fillable viaisFillable()overridecustom_fieldscustom_fieldsin temp storage when filling