From 1b5474f7b8f2f5cea7d1dfbab6938d96f4239c3d Mon Sep 17 00:00:00 2001 From: Jacob Baker-Kretzmar Date: Fri, 22 May 2020 12:24:02 -0400 Subject: [PATCH] Update README to document the route check() method --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index b135bb3d..d98d30ab 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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.