Open
Description
Q | A |
---|---|
Bug? | yes |
New Feature? | no |
Framework | Laravel |
Framework version | 9.48.0 |
Package version | 13.0 |
PHP version | 8.1 |
Actual Behaviour
When updatinga BelongsTo relation, the old_values id is parsed to an Int
instead of a string
.
This makes searching with whereJsonContains
unpossible because you'll have to always check for both types
This is how I need to check in the audits table for a presence value now:
Audit::whereJsonContains('old_values', ['protocol_id' => $this->id])
->orWhereJsonContains('old_values', ['protocol_id' => (string)$this->id])
->orWhereJsonContains('new_values', ['protocol_id' => $this->id])
->exists();
Expected Behaviour
When updating a BelongsTo relation, the old_value of the id should be parsed to a string like any other action.
**old_values
"model_id":"9",
Steps to Reproduce
- Make a belongsTo Many relation
- Attach the BelongsTo
- Update the BelongsTo
- Now you can see the different type in the old_values column
Possible Solutions
Hard cast to (Int)
Metadata
Metadata
Assignees
Labels
No labels