laravel json code example
Example 1: laravel json response
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
]);
Example 2: laravel query json
$users = DB::table('users')
->whereJsonContains('options->languages', ['en', 'de'])
->get();
Example 3: Laravel json response
return response()->json($array);
Example 4: laravel json eloquent
protected $casts = [
'birthday' => 'date:Y-m-d',
'joined_at' => 'datetime:Y-m-d H:00',
];