laravel to json code example
Example 1: convert json string to json object in laravel
$manage = json_decode($request->stdin, true);
print_r($manage);
Example 2: laravel json response
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
]);
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',
];