public function changePassword(Request $request) { if ($request->input('user') == 'passenger') { $user = new Passenger(); return $user->changePassword($request->input('contactNo'), $request->input('password')); } elseif ($request->input('user') == 'driver') { $user = new Driver(); return $user->changePassword($request->input('contactNo'), $request->input('password')); } }