private function _returnSuccess(Entry $entry, $isSpam = false): Response
    {
        if ($this->hasEventHandlers(self::EVENT_AFTER_SAVE_ENTRY)) {
            $this->trigger(self::EVENT_AFTER_SAVE_ENTRY, new SaveEvent([
                'entry' => $entry,
                'isSpam' => $isSpam
            ]));
        }

        if (Craft::$app->getRequest()->getAcceptsJson()) {
            return $this->asJson([
                'success' => true,
                'id' => $entry->id,
                'title' => $entry->title,
                'authorUsername' => $entry->getAuthor()->username,
                'dateCreated' => DateTimeHelper::toIso8601($entry->dateCreated),
                'dateUpdated' => DateTimeHelper::toIso8601($entry->dateUpdated),
                'postDate' => $entry->postDate ? DateTimeHelper::toIso8601($entry->postDate) : null,
                'url' => $entry->getUrl(),
            ]);
        }

        Craft::$app->getSession()->setNotice(Craft::t('guest-entries', 'Entry saved.'));

        return $this->redirectToPostedUrl($entry);
    }
private function _returnSuccess(Entry $entry, $isSpam = false): Response
    {
        if ($this->hasEventHandlers(self::EVENT_AFTER_SAVE_ENTRY)) {
            $this->trigger(self::EVENT_AFTER_SAVE_ENTRY, new SaveEvent([
                'entry' => $entry,
                'isSpam' => $isSpam
            ]));
        }

        if (Craft::$app->getRequest()->getAcceptsJson()) {
            return $this->asJson([
                'success' => true,
                'id' => $entry->id,
                'title' => $entry->title,
                'authorUsername' => $entry->getAuthor()->username,
                'dateCreated' => DateTimeHelper::toIso8601($entry->dateCreated),
                'dateUpdated' => DateTimeHelper::toIso8601($entry->dateUpdated),
                'postDate' => $entry->postDate ? DateTimeHelper::toIso8601($entry->postDate) : null,
                'url' => $entry->getUrl(),
            ]);
        }

        Craft::$app->getSession()->setNotice(Craft::t('guest-entries', 'Entry saved.'));

        return $this->redirectToPostedUrl($entry);
    }
private function _returnSuccess ( Entry $ entry , $ isSpam = false ) : Response { if ( $ this -> hasEventHandlers ( self :: EVENT_AFTER_SAVE_ENTRY ) ) { $ this -> trigger ( self :: EVENT_AFTER_SAVE_ENTRY , new SaveEvent ( [ 'entry' => $ entry , 'isSpam' => $ isSpam ] ) ) ; } if ( Craft :: $ app -> getRequest ( ) -> getAcceptsJson ( ) ) { return $ this -> asJson ( [ 'success' => true , 'id' => $ entry -> id , 'title' => $ entry -> title , 'authorUsername' => $ entry -> getAuthor ( ) -> username , 'dateCreated' => DateTimeHelper :: toIso8601 ( $ entry -> dateCreated ) , 'dateUpdated' => DateTimeHelper :: toIso8601 ( $ entry -> dateUpdated ) , 'postDate' => $ entry -> postDate ? DateTimeHelper :: toIso8601 ( $ entry -> postDate ) : null , 'url' => $ entry -> getUrl ( ) , ] ) ; } Craft :: $ app -> getSession ( ) -> setNotice ( Craft :: t ( 'guest-entries' , 'Entry saved.' ) ) ; return $ this -> redirectToPostedUrl ( $ entry ) ; }
Returns a 'success' response.

@param Entry $entry
@param       $isSpam
@return Response
Returns a success response .