Skip to content

fix: support $guarded models and MariaDB driver [3.x]#124

Merged
ManukMinasyan merged 2 commits into3.xfrom
fix/guarded-models-mariadb-support
Mar 23, 2026
Merged

fix: support $guarded models and MariaDB driver [3.x]#124
ManukMinasyan merged 2 commits into3.xfrom
fix/guarded-models-mariadb-support

Conversation

@ManukMinasyan
Copy link
Copy Markdown
Collaborator

@ManukMinasyan ManukMinasyan commented Mar 20, 2026

Summary

  • Models using $guarded instead of $fillable couldn't save custom fields. Replace mergeFillable with isFillable() and fillableFromArray() overrides.
  • Add MariaDB to text_value driver-specific constraints (matches MySQL at 65535).

Closes #121
Closes #120

Test plan

  • Guarded model recognizes custom_fields as fillable via isFillable() override
  • Guarded model can mass-assign custom_fields
  • Guarded model stores custom_fields in temp storage when filling
  • MariaDB included in text_value constraints
  • MariaDB constraint matches MySQL value
  • Full test suite passes (no regressions)

Copilot AI review requested due to automatic review settings March 20, 2026 19:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 UsesCustomFields to add custom_fields to fillable when $guarded is non-empty.
  • Add mariadb to the text_value driver-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.

@ManukMinasyan ManukMinasyan force-pushed the fix/guarded-models-mariadb-support branch 2 times, most recently from f362c9a to f168945 Compare March 23, 2026 17:10
- Replace mergeFillable with isFillable() and fillableFromArray() overrides
  so models using $guarded instead of $fillable can save custom fields
- Add MariaDB to text_value driver-specific constraints (matches MySQL)

Closes #121
Closes #120
@ManukMinasyan ManukMinasyan force-pushed the fix/guarded-models-mariadb-support branch from f168945 to 90d4aca Compare March 23, 2026 17:19
@ManukMinasyan ManukMinasyan merged commit 653534c into 3.x Mar 23, 2026
3 checks passed
@ManukMinasyan ManukMinasyan deleted the fix/guarded-models-mariadb-support branch March 23, 2026 17:58
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.

[1.5.25] Models using $guarded can't save custom fields [1.5.25] MariaDB connector isn't supported

2 participants