There was an error while loading. Please reload this page.
USSD decision help us to know how to transition from one state to the other based on user input.
By default Laravel USSD comes in built with the following decisions.
use Speso\Ussd\Decisions; new Decisions\Between(12, 24); new Decisions\Equal('1'); new Decisions\Fallback(); new Decisions\GreaterThan(2); new Decisions\GreaterThanOrEqualTo(1); new Decisions\In('1', '3'); new Decisions\IsNumeric(); new Decisions\Length(10); new Decisions\LessThan(1); new Decisions\LessThanOrEqualTo(10); new Decisions\NotBetween(5, 10) new Decisions\NotEqual(1) new Decisions\NotIn('name', 'age'); new Decisions\Regex('/+d/');
Inbuilt decision have a loose comparison. You can add custom decision that meet your application needs.
php artisan ussd:decision StrictEqual
Implement your decision logic
<?php namespace App\Ussd\Decisions; use Speso\Ussd\Contracts\Decision; class StrictEqual implements Decision { public function __construct(private string $expected) { } public function decide(string $actual): bool { return $this->expected === $actual; } }
Use your decision
new App\Ussd\Decisions\StrictEqual('2');