/** * Get all popular doctors. * * @param Request $request * * @return string */ public function getPopular(Request $request) { $this->validate($request, ['num' => 'integer|min:1']); $num = $request->get('num'); if (empty($num)) { $num = 10; } return Doctor::popular($num)->get(); }