| 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
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)
Actual Behaviour
When updatinga BelongsTo relation, the old_values id is parsed to an
Intinstead of astring.This makes searching with
whereJsonContainsunpossible because you'll have to always check for both typesThis is how I need to check in the audits table for a presence value now:
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
Steps to Reproduce
Possible Solutions
Hard cast to (Int)