src/Http/Controllers/UssdController.php
public function confirmGoBack($user, $message)
    {

        if (self::validationVariations($message, 1, "yes")) {
            //go back to the main menu
            self::resetUser($user);

            $user->menu_id = 2;
            $user->session = 1;
            $user->progress = 1;
            $user->save();
            //get home menu
            $menu = ussd_menu::find(2);
            $menu_items = self::getMenuItems($menu->id);
            $i = 1;
            $response = $menu->title . PHP_EOL;
            foreach ($menu_items as $key => $value) {
                $response = $response . $i . ": " . $value->description . PHP_EOL;
                $i++;
            }
            self::sendResponse($response, 1, $user);
            exit;

        } elseif (self::validationVariations($message, 2, "no")) {
            $response = "Thank you for using our service";
            self::sendResponse($response, 3, $user);

        } else {
            $response = '';
            self::sendResponse($response, 2, $user);
            exit;
        }

    }
public function confirmGoBack($user, $message)
    {

        if (self::validationVariations($message, 1, "yes")) {
            //go back to the main menu
            self::resetUser($user);

            $user->menu_id = 2;
            $user->session = 1;
            $user->progress = 1;
            $user->save();
            //get home menu
            $menu = ussd_menu::find(2);
            $menu_items = self::getMenuItems($menu->id);
            $i = 1;
            $response = $menu->title . PHP_EOL;
            foreach ($menu_items as $key => $value) {
                $response = $response . $i . ": " . $value->description . PHP_EOL;
                $i++;
            }
            self::sendResponse($response, 1, $user);
            exit;

        } elseif (self::validationVariations($message, 2, "no")) {
            $response = "Thank you for using our service";
            self::sendResponse($response, 3, $user);

        } else {
            $response = '';
            self::sendResponse($response, 2, $user);
            exit;
        }

    }
public function confirmGoBack ( $ user , $ message ) { if ( self :: validationVariations ( $ message , 1 , "yes" ) ) { //go back to the main menu self :: resetUser ( $ user ) ; $ user -> menu_id = 2 ; $ user -> session = 1 ; $ user -> progress = 1 ; $ user -> save ( ) ; //get home menu $ menu = ussd_menu :: find ( 2 ) ; $ menu_items = self :: getMenuItems ( $ menu -> id ) ; $ i = 1 ; $ response = $ menu -> title . PHP_EOL ; foreach ( $ menu_items as $ key => $ value ) { $ response = $ response . $ i . ": " . $ value -> description . PHP_EOL ; $ i ++ ; } self :: sendResponse ( $ response , 1 , $ user ) ; exit ; } elseif ( self :: validationVariations ( $ message , 2 , "no" ) ) { $ response = "Thank you for using our service" ; self :: sendResponse ( $ response , 3 , $ user ) ; } else { $ response = '' ; self :: sendResponse ( $ response , 2 , $ user ) ; exit ; } }
confirm go back
confirm go back