src/SlackDriver.php
public function extendConversation()
    {
        Conversation::macro('sendDialog', function (Dialog $dialog, $next, $additionalParameters = []) {
            $response = $this->bot->replyDialog($dialog, $additionalParameters);

            $validation = function ($answer) use ($dialog, $next, $additionalParameters) {
                $errors = $dialog->errors(Collection::make($answer->getValue()));
                if (count($errors)) {
                    $this->bot->touchCurrentConversation();

                    return Response::create(json_encode(['errors' => $errors]), 200, ['ContentType' => 'application/json'])->send();
                } else {
                    if ($next instanceof \Closure) {
                        $next = $next->bindTo($this, $this);
                    }
                    $next($answer);
                }
            };
            $this->bot->storeConversation($this, $validation, $dialog, $additionalParameters);

            return $response;
        });
    }
public function extendConversation()
    {
        Conversation::macro('sendDialog', function (Dialog $dialog, $next, $additionalParameters = []) {
            $response = $this->bot->replyDialog($dialog, $additionalParameters);

            $validation = function ($answer) use ($dialog, $next, $additionalParameters) {
                $errors = $dialog->errors(Collection::make($answer->getValue()));
                if (count($errors)) {
                    $this->bot->touchCurrentConversation();

                    return Response::create(json_encode(['errors' => $errors]), 200, ['ContentType' => 'application/json'])->send();
                } else {
                    if ($next instanceof \Closure) {
                        $next = $next->bindTo($this, $this);
                    }
                    $next($answer);
                }
            };
            $this->bot->storeConversation($this, $validation, $dialog, $additionalParameters);

            return $response;
        });
    }
public function extendConversation ( ) { Conversation :: macro ( 'sendDialog' , function ( Dialog $ dialog , $ next , $ additionalParameters = [ ] ) { $ response = $ this -> bot -> replyDialog ( $ dialog , $ additionalParameters ) ; $ validation = function ( $ answer ) use ( $ dialog , $ next , $ additionalParameters ) { $ errors = $ dialog -> errors ( Collection :: make ( $ answer -> getValue ( ) ) ) ; if ( count ( $ errors ) ) { $ this -> bot -> touchCurrentConversation ( ) ; return Response :: create ( json_encode ( [ 'errors' => $ errors ] ) , 200 , [ 'ContentType' => 'application/json' ] ) -> send ( ) ; } else { if ( $ next instanceof \ Closure ) { $ next = $ next -> bindTo ( $ this , $ this ) ; } $ next ( $ answer ) ; } } ; $ this -> bot -> storeConversation ( $ this , $ validation , $ dialog , $ additionalParameters ) ; return $ response ; } ) ; }
Extend BotMan conversation class.
Extend BotMan conversation class .