public function summary_listing() { $next_call = Call::where('status', '=', 'OPEN')->where('end_date', '>=', Carbon::now())->where('publish', '=', true)->orderBy('end_date', 'asc')->first(); $promoted_calls = Call::where('status', '=', 'OPEN')->where('end_date', '>=', Carbon::now())->where('publish', '=', true)->where('remark', '=', true)->orderBy('end_date', 'asc')->get(); $active_calls = Call::where('status', '=', 'OPEN')->where('end_date', '>=', Carbon::now())->where('publish', '=', true)->orderBy('end_date', 'asc')->get(); foreach ($active_calls as $a_call) { $a_call->resources; } foreach ($promoted_calls as $p_call) { $p_call->resources; } $summary = array('next_call' => $next_call, 'promoted_calls' => $promoted_calls, 'active_calls' => $active_calls); return $summary; }