I'm trying to get schedules comparing the JSON column data with following code in a Laravel project:
$schedules = Schedule::where('schedule_with->company_person', $contact_company_person->id)->get();
This generates SQL query like below:
select * from `schedules` where `schedule_with`->'$."company_person"' = 1;
While this works for MYSQL 5.7 and above but not working for MARIADB 10.5. But MARIADB already supports JSON column from 10.2 onward. For MARIADB, following query works:
select * from schedules where JSON_Value(schedule_with, "$.company_person") = 3;
Is there some config changes required in Laravel to make it work?
I know it can be achieved with raw query, I'm curious about what am I missing?