48 lines
1.4 KiB
PHP
48 lines
1.4 KiB
PHP
<?php
|
|
|
|
// namespace App\Conversations;
|
|
namespace App\Controllers\Chatbot;
|
|
|
|
use BotMan\BotMan\Messages\Conversations\Conversation;
|
|
use BotMan\BotMan\Messages\Outgoing\Question;
|
|
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
|
|
|
|
|
class ReimbursementClaimStatusConversation extends Conversation
|
|
{
|
|
|
|
|
|
public function run()
|
|
{
|
|
$this->claimStatus();
|
|
}
|
|
|
|
protected function claimStatus()
|
|
{
|
|
$question = Question::create("Do you Need Anything Else ?")
|
|
->addButtons([
|
|
Button::create("🔹 Yes I need some more Help")->value("yes"),
|
|
Button::create("🔹 No, Thank You")->value("no"),
|
|
// Button::create("◀️ Go Back")->value("go_back"),
|
|
]);
|
|
|
|
$this->bot->ask($question, function ($answer) {
|
|
switch ($answer->getValue()) {
|
|
case "yes":
|
|
|
|
$this->say("Sure, How can I help you ");
|
|
$this->bot->startConversation(new MainMenuConversation());
|
|
break;
|
|
case "no":
|
|
$this->say("Thank you for your time! If you need anything else, feel free to reach out. Goodbye!");
|
|
break;
|
|
default:
|
|
$this->say("Invalid selection. Please choose an option.");
|
|
$this->askQuestion();
|
|
break;
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|