50 lines
1.5 KiB
PHP
50 lines
1.5 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;
|
|
|
|
use App\Helpers\ChatbotHelper;
|
|
|
|
class hospitalPolicyConversation extends Conversation
|
|
{
|
|
|
|
|
|
public function run()
|
|
{
|
|
$this->showMediclaimPolicyOptions();
|
|
}
|
|
|
|
protected function showMediclaimPolicyOptions()
|
|
{
|
|
$question = Question::create("Choose Policy Type:")
|
|
->addButtons([
|
|
Button::create("🔹 Individual")->value("individual"),
|
|
Button::create("🔹 Floater")->value("floater"),
|
|
Button::create("◀️ Go Back")->value("go_back"),
|
|
]);
|
|
|
|
$this->bot->ask($question, function ($answer) {
|
|
switch ($answer->getValue()) {
|
|
case "individual":
|
|
$this->bot->startConversation(new commonPolicyOptionConversations());
|
|
break;
|
|
case "floater":
|
|
$this->bot->startConversation(new commonPolicyOptionConversations());
|
|
break;
|
|
case "go_back":
|
|
$this->bot->startConversation(new MainMenuConversation());
|
|
break;
|
|
default:
|
|
$this->say("Invalid selection. Please choose an option.");
|
|
$this->showHospitalMenu();
|
|
break;
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|