Package Data | |
---|---|
Maintainer Username: | jackpopp |
Maintainer Contact: | jack@jackpopp.com (Jack Hannigan Popp) |
Package Create Date: | 2014-08-29 |
Package Last Update: | 2015-05-01 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:14:18 |
Package Statistics | |
---|---|
Total Downloads: | 28 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 4 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Register named routes in routes.php and add they key tura with the value true to the options array. Tura will only expose routes which have been set to be exposed.
Route::get('/', array(
'uses' => 'HomeController@index',
'as' => 'home',
'tura' => true
));
Route::get('user', array(
'uses' => 'HomeController@index',
'as' => 'user.create'
));
Route::get('user/{id}', array(
'uses' => 'HomeController@index',
'as' => 'user.show',
'tura' => true
));
You can now access your exposed named routes as a JSON object by calling the fetch routes method (this could be called in your master blade layout for example).
Tura::fetchRoutes();
The named routes will now be available in the javascript global scope by calling the tura object
console.log(tura)
Object {home: "/", user.show: "user/{id}"}
console.log(tura['user.show'])
"user/{id}"
Install via composer add to require in composer.json
"jackpopp/tura": "dev-master"
Add the service provider and class alias to app.php config (found in app/config/app.php)
Add to the providers array
'Jackpopp\Tura\TuraServiceProvider',
Add to the aliases array
'Tura' => 'Jackpopp\Tura\TuraServiceProvider',