/** * Display a listing of the resource. * * @return Response */ public function index() { // Return all data accounts $temp = []; $dataac = DataAccount::all(); foreach ($dataac as $k => $v) { $v->keywordCount = Keyword::where('dataAccount', $v->id)->count(); $v->landingPageUrls = $v->landingPageUrls()->get(); // Laravel's magic $temp[] = $v; } return Response::json($temp); //return Response::make(DataAccount::get()); }