nhance/app/Controllers/Chatbot/fourWheelerOptionsConversations.php
2025-02-03 10:26:49 +05:30

51 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 fourWheelerOptionsConversations extends Conversation
{
public function run()
{
$this->show4WOptions();
}
protected function show4WOptions()
{
$question = Question::create("Choose Policy Type:")
->addButtons([
Button::create("🔹 Comprehensive")->value("comp"),
Button::create("🔹 Third-Party Only")->value("3p"),
Button::create("◀️ Go Back")->value("go_back"),
]);
$this->bot->ask($question, function ($answer) {
switch ($answer->getValue()) {
case "3p":
// $cityName = $response->getText();
$this->bot->startConversation(new commonPolicyOptionConversations());
break;
case "comp":
$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;
}
});
}
}