protected function signup(Request $request) { $credentials = $request->only('email', 'password', 'name'); $credentials['password'] = bcrypt($credentials['password']); try { $user = User::create($credentials); } catch (\Tymon\JWTAuth\Exceptions\JWTException $e) { return response()->json(['error' => 'Could not create user.'], 409); } catch (\QueryException $e) { return response()->json(['error' => 'Email already exists.'], 409); } $token = JWTAuth::fromUser($user); return response()->json(compact('token')); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { User::destroy($id); Session::flash('flash_message', 'User deleted!'); return redirect('admin/users'); }