Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the route check() method #294

Merged
merged 1 commit into from
May 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Ziggy supports all versions of Laravel from `5.4` to `7.x`.
- [Advanced Whitelisting using Groups](#advanced-whitelisting-using-groups)
- [Other Useful Methods](#other-useful-methods)
- [`current()`](#current)
- [`check()`](#check)
- [`url()`](#url)
- [Artisan Command](#artisan-command)
- [Using with Vue Components](#using-with-vue-components)
Expand Down Expand Up @@ -211,6 +212,15 @@ route().current('events.*');
// returns true
```

#### `check()`

Ziggy can check if a given named route is defined:

```js
route().check('home');
// returns true if a route name 'home' exists, false otherwise
```

#### `url()`

Ziggy returns a wrapper of the JavaScript [String primitive](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), which behaves exactly like a string in almost all cases. In rare cases, such as when third-party libraries use strict type checking, you may need an actual string literal.
Expand Down