//json encode
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
]);
//now decode
$response = json_decode($response->getContent()) ;
public function getOrgById(Request $request){
// do something here...
return response()->json(array('foo' => 'bar'));
}
protected $casts = [
'birthday' => 'date:Y-m-d',
'joined_at' => 'datetime:Y-m-d H:00',
];
$report=json_encode(Teacher::with('students')->get());
return view('admin.index',compact('report'));