37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Chatbot;
|
|
|
|
use BotMan\BotMan\BotMan;
|
|
use BotMan\BotMan\Messages\Outgoing\Actions\ButtonTemplate;
|
|
use BotMan\BotMan\Messages\Outgoing\Actions\ElementButton;
|
|
|
|
class PolicyHandler
|
|
{
|
|
public static function handle(BotMan $bot, $option)
|
|
{
|
|
$responses = [
|
|
'ecard_download' => "Ecard Download: Here is a dummy response.",
|
|
'network_hospital' => "Network Hospital: Here is a dummy response.",
|
|
'new_policy' => "New Policy: Here is a dummy response.",
|
|
'renew_policy' => "Renew Policy: Here is a dummy response."
|
|
];
|
|
|
|
if (isset($responses[$option])) {
|
|
$bot->reply($responses[$option]);
|
|
} else {
|
|
$bot->reply("Unknown policy option.");
|
|
}
|
|
|
|
// Send Back Button
|
|
self::sendBackButton($bot);
|
|
}
|
|
|
|
private static function sendBackButton(BotMan $bot)
|
|
{
|
|
$bot->reply(ButtonTemplate::create("Would you like to return?")
|
|
->addButton(ElementButton::create("Go Back")->type('postback')->payload("main_menu"))
|
|
);
|
|
}
|
|
}
|