You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use Glaze to access your Alpasnamed routes from inside your JavaScript.
Usage
You can use Glaze in one of two ways - using glaze template function that will make a global Glaze JavaScript object as well as a route() helper function, you can then call these to access named routes in your JavaScript.
You can also integrate Glaze with Mix by importing it in your asset pipeline. You can then use it from a frontend library like VueJS easily.
Add {{ glaze() }} in one of your layout template's <head> section. Any scripts added after this will have access to a global Glaze object and a route() helper function.
Using it from a VueJS component
Publish all the required scripts by using the alpas glaze:publish console command. This will add two scripts — route.js and glaze.js — in resources/js folder.
You can now use the route() method in your Vue components like so: <a :href="route('login')">Login</a>
Or you can call it from your VueJS component's script like so: this.route('login')
Glaze Config
You can set the base URL to be used for each routes by extending the GlazeConfig file.
Glaze is hugely inspired and based on Ziggy and js-routes.
About
🍩 Access Alpas named routes inside your JavaScript