Skip to content

Commit

Permalink
Merge branch 'master' into default-parameter-property
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebathman committed Oct 18, 2019
2 parents 2303d22 + 84e65e6 commit 50fdf04
Show file tree
Hide file tree
Showing 7 changed files with 1,229 additions and 1,195 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ In the above example, you can see we have configured multiple whitelists for dif
```php
@routes('author')
```

Or if you want to expose multiple groups you can pass an array of group names. Example:

```php
@routes(['admin', 'author'])
```

**Note: Using a group will always take precedence over the above mentioned `whitelist` and `blacklist` settings.**

### Other useful methods
Expand Down Expand Up @@ -298,6 +305,7 @@ return [
To get started contributing to Ziggy, check out [the contribution guide](CONTRIBUTING.md).

- [Daniel Coulbourne](https://twitter.com/DCoulbourne)
- [Jake Bathman](https://twitter.com/jakebathman)
- [Matt Stauffer](https://twitter.com/stauffermatt)

Thanks to [Caleb Porzio](http://twitter.com/calebporzio), [Adam Wathan](http://twitter.com/adamwathan), and [Jeffrey Way](http://twitter.com/jeffrey_way) for help solidifying the idea.
Expand Down
19 changes: 17 additions & 2 deletions dist/js/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,9 @@ function (_String) {
_this.name = name;
_this.absolute = absolute;
_this.ziggy = customZiggy ? customZiggy : Ziggy;
_this.template = _this.name ? new js_UrlBuilder(name, absolute, _this.ziggy).construct() : '', _this.urlParams = _this.normalizeParams(params);
_this.urlBuilder = _this.name ? new js_UrlBuilder(name, absolute, _this.ziggy) : null;
_this.template = _this.urlBuilder ? _this.urlBuilder.construct() : '';
_this.urlParams = _this.normalizeParams(params);
_this.queryParams = {};
_this.hydrated = '';
return _this;
Expand Down Expand Up @@ -1074,7 +1076,7 @@ function (_String) {
var _this2 = this;

if (this.hydrated) return this.hydrated;
return this.hydrated = this.template.replace(/{([^}]+)}/gi, function (tag, i) {
var hydrated = this.template.replace(/{([^}]+)}/gi, function (tag, i) {
var keyName = _this2.trimParam(tag),
defaultParameter = _this2.ziggy.defaultParameters[keyName],
tagValue; // If a default parameter exists, and a value wasn't
Expand Down Expand Up @@ -1113,6 +1115,13 @@ function (_String) {

return encodeURIComponent(tagValue);
});

if (this.urlBuilder != null && this.urlBuilder.path !== '') {
hydrated = hydrated.replace(/\/+$/, '');
}

this.hydrated = hydrated;
return this.hydrated;
}
}, {
key: "matchUrl",
Expand Down Expand Up @@ -1164,6 +1173,12 @@ function (_String) {

return currentRoute;
}
}, {
key: "check",
value: function check(name) {
var routeNames = Object.keys(this.ziggy.namedRoutes);
return routeNames.includes(name);
}
}, {
key: "extractParams",
value: function extractParams(uri, template, delimiter) {
Expand Down
2 changes: 1 addition & 1 deletion dist/js/route.min.js

Large diffs are not rendered by default.

0 comments on commit 50fdf04

Please sign in to comment.