/**
  * @return mixed
  */
 public function login()
 {
     $code = Input::get('username');
     $password = Input::get('password');
     $user = User::where("code", $code)->get()->first();
     if ($user && \Hash::check($password, $user->PassHash)) {
         \Auth::login($user);
         return $user->toJson();
     }
     throw new ModelNotFoundException();
 }