51 lines
1.6 KiB
PHP
51 lines
1.6 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 commonPolicyOptionConversations extends Conversation
|
|
{
|
|
|
|
|
|
public function run()
|
|
{
|
|
$this->policyOptions();
|
|
}
|
|
|
|
protected function policyOptions()
|
|
{
|
|
$question = Question::create("Choose Policy Type:")
|
|
->addButtons([
|
|
Button::create("🔹 Upload Vehicle Details")->value("upload_vehicle_details"),
|
|
Button::create("🔹 Talk to our Service Executive")->value("service_executive"),
|
|
Button::create("◀️ Go Back")->value("go_back"),
|
|
]);
|
|
|
|
$this->bot->ask($question, function ($answer) {
|
|
switch ($answer->getValue()) {
|
|
case "upload_vehicle_details":
|
|
// $cityName = $response->getText();
|
|
$this->bot->startConversation(new vehicleFormConversation());
|
|
break;
|
|
case "service_executive":
|
|
$this->bot->startConversation(new serviceExecutiveConversation());
|
|
break;
|
|
case "go_back":
|
|
$this->bot->startConversation(new MainMenuConversation());
|
|
break;
|
|
default:
|
|
$this->say("Invalid selection. Please choose an option.");
|
|
$this->policyOptions();
|
|
break;
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|