Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel eloquent search json column

// Data
/*[
    {
        "emailAddress": {
            "name": "Test", 
            "address": "test@example.com"
        }
    }, 
    {
        "emailAddress": {
            "name": "Test 2", 
            "address": "test2@example.com"
        }
    }
]*/
DB::table('emails')
   ->whereJsonContains('to', [['emailAddress' => ['address' => 'test@example.com']]])
   ->get()

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

PREVIOUS NEXT
Code Example
Php :: why storage link do not work in host for laravel 
Php :: update session laravel 
Php :: advanced custom forms php 
Php :: round to 2 decimal places php 
Php :: how to remove keys in subarray php 
Php :: php intval 
Php :: laravel form request validation unique update 
Php :: laravel is route name 
Php :: laravel cache remember 
Php :: laravel model where 
Php :: woocommerce change add to cart message 
Php :: pg_dump with user name password 
Php :: php print array nice format 
Php :: base url dinamis codeigniter 
Php :: Date Format Conversion in controller or Blade file 
Php :: php geolocation package 
Php :: create controller with model resources and request command in laravel 
Php :: php object 
Php :: php match 
Php :: wp get attachment id 
Php :: php json response to ajax 
Php :: custom rule laravel validation 
Php :: laravel local file storage 
Php :: array reverse php 
Php :: Enqueue WordPress Scripts and Styles 
Php :: zip missing php install 
Php :: laravel when condition 
Php :: add controller to laravel with requests 
Php :: php get last digit of number 
Php :: date_default_timezone_set(): timezone id 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =