id = $id; $this->code = $code; } public function build(): sendVerifyCode { return $this->view('emails.sendVerifyCode')->subject('发送注册验证码')->with( [ 'code' => $this->code, ] ); } // 发件失败处理 public function failed(Exception $e): void { NotificationLog::whereId($this->id)->update( ['status' => -1, 'error' => $e->getMessage()] ); } }