Skip to content

Commit

Permalink
Merge pull request #144 from RomeroMsk/patch-1
Browse files Browse the repository at this point in the history
CommandRouteGenerator defaultParameters fix
  • Loading branch information
DanielCoulbourne authored Mar 27, 2018
2 parents e6f55c6 + 7b3f033 commit 24192a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/CommandRouteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ public function generate($group = false)
$this->prepareDomain();

$json = $this->getRoutePayload($group)->toJson();

$defaultParameters = method_exists(app('url'), 'getDefaultParameters') ? json_encode(app('url')->getDefaultParameters()) : '[]';

return <<<EOT
var Ziggy = {
namedRoutes: $json,
baseUrl: '{$this->baseUrl}',
baseProtocol: '{$this->baseProtocol}',
baseDomain: '{$this->baseDomain}',
basePort: {$this->basePort}
basePort: {$this->basePort},
defaultParameters: $defaultParameters
};
export {
Expand Down
3 changes: 2 additions & 1 deletion tests/assets/js/ziggy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
baseUrl: 'http://myapp.com/',
baseProtocol: 'http',
baseDomain: 'myapp.com',
basePort: false
basePort: false,
defaultParameters: []
};

export {
Expand Down

0 comments on commit 24192a2

Please sign in to comment.