nhance/app/Controllers/Chatbot/ClaimHandler.php
2025-02-01 10:29:43 +05:30

35 lines
998 B
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 ClaimHandler
{
public static function handle(BotMan $bot, $option)
{
$responses = [
'reimbursement_claim_process' => "Reimbursement Claim Process: Here is a dummy response.",
'reimbursement_claim_status' => "Reimbursement Claim Status: Here is a dummy response."
];
if (isset($responses[$option])) {
$bot->reply($responses[$option]);
} else {
$bot->reply("Unknown claim 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"))
);
}
}