@prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ class AuthController extends Controller { /** * To get the details of user to display on profile * * @return response JSON */ public function create() { $data = request()->except('_token'); if(!auth()->guard('customer')->check()) { if(!auth()->guard('customer')->attempt($data)) { return response()->json(['unauthenticated', 'invalid creds'], 401); } else { return response()->json(['authenticated'], 200); } } else { return response()->json(['already authenticated'], 200); } } public function destroy() { if(auth()->guard('customer')->logout()) { return response()->json(['logged out'], 200); } else { return response()->json(['already logged out'], 200); } } }