dimanche 3 mars 2019

How to search in json array object with laravel query builder?

Here is json array

"section_4": {
"data": [
{
"grade": "3.0",
"degree": "BSCSE",
"end_date": "2019-03-28T10:35:00.000Z",
"institute": "DIU",
"start_date": "2019-03-25T10:35:00.000Z"
},
{
"grade": "4.0",
"degree": "BSCSE",
"end_date": "2019-04-30T10:50:00.000Z",
"institute": "STU",
"start_date": "2019-03-31T10:50:00.000Z"
}
],
"type": "education",
"title": "Educations"
},

Want to search with grade, is it possible to search with query builder?

$resumes = UserMeta::with(['user.resume' => function ($query) {
                $query->where('data->section_4->type', 'like', '%education%');
        }])->paginate(10);

Here is code to try to search in controller. is it possible to search with grade with query builder laravel?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire