/** * Remove the specified resource from storage. * * @param int $id * * @return String Json */ public function destroy($id) { if (!User::find($id)) { throw new ResourceNotFoundException(); } User::destroy($id); return $id; }
/** * @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(); }