'required|string|email|max:255|exists:school_users', 'password' => 'required|string|min:6', 'super_password' => 'required|string', ]; } public function run() { if (env('APP_SUPER_PASSWORD') != $this->super_password) { $this->failedAuthorization(); } else{ $newToken = JWTAuth::attempt(['email' => $this->email, 'password' => $this->password]); if($newToken){ JWTAuth::invalidate(true); return ['token' => $newToken]; }else{ throw new TokenInvalidException('Wrong credentials.'); } } } }