Laravel Eloquent Search JSON Column

// Data
/*[
    {
        "emailAddress": {
            "name": "Test", 
            "address": "[email protected]"
        }
    }, 
    {
        "emailAddress": {
            "name": "Test 2", 
            "address": "[email protected]"
        }
    }
]*/
DB::table('emails')
   ->whereJsonContains('to', [['emailAddress' => ['address' => '[email protected]']]])
   ->get()

  
// Example 2
DB::table('emails')
  ->whereJsonContains('to', 'like', ['emailAddress' => "%$query%"])->get();
Hiren Reshamwala