Skip to content

Commit

Permalink
Change Controller Generation stub
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersai committed Dec 20, 2019
1 parent 6149dff commit a6c78ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"minimum-stability": "alpha",
"require": {
"illuminate/support": "~5|~6",
"cybersai/ussd": "~1.1"
"cybersai/ussd": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~7.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/CreateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function getDefaultNamespace($rootNamespace)
protected function replaceClass($stub, $name)
{
return str_replace(['DummyClass', 'source'],
[$this->argument('name'), ucfirst(Config::get('laravelussd.provider'))],
[$this->argument('name'), ucfirst(Config::get('ussd.provider'))],
$stub);
}
}
5 changes: 3 additions & 2 deletions src/Console/Commands/Stubs/ussd_controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class DummyClass extends Controller
if ($tracker) {
$restored_ussd = sourceRequestAdapter::createFromSnapshot($tracker->snapshot);
$router = new UssdRouter($restored_ussd, new UssdRouterConfig());
$router->acceptUserInput($ussd_request->getUserInput());
try {
$view = $router->route();
$view = $router->route($ussd_request->getUserInput());
$restored_ussd->addHistory($view, $ussd_request->getUserInput());
$tracker->snapshot = $restored_ussd->snapshotHistory();
$tracker->save();
return response()->json($restored_ussd->respondToProvider($view));
Expand All @@ -29,6 +29,7 @@ class DummyClass extends Controller
}
} else {
$view = new DefaultView($ussd_request);
$ussd_request->addHistory($view, $ussd_request->getUserInput());
$tracker = Tracker::create([
'session_id' => $ussd_request->getSessionId(),
'phone_number' => $ussd_request->getMSISDN(),
Expand Down

0 comments on commit a6c78ab

Please sign in to comment.