2017 © Pedro Peláez
 

library tura

Tura - use laravel named routes in your javascript.

image

jackpopp/tura

Tura - use laravel named routes in your javascript.

  • Friday, May 1, 2015
  • by jackpopp
  • Repository
  • 4 Watchers
  • 9 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Tura

Use laravel named routes in your javascript.

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., (*1)

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)., (*2)

Tura::fetchRoutes();

The named routes will now be available in the javascript global scope by calling the tura object, (*3)

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, (*4)

"jackpopp/tura": "dev-master"

Add the service provider and class alias to app.php config (found in app/config/app.php), (*5)

Add to the providers array, (*6)

'Jackpopp\Tura\TuraServiceProvider',

Add to the aliases array, (*7)

'Tura' => 'Jackpopp\Tura\TuraServiceProvider',

The Versions

01/05 2015

dev-master

9999999-dev

Tura - use laravel named routes in your javascript.

  Sources   Download

MIT

The Requires

 

by Jack Hannigan Popp

01/05 2015

1.2

1.2.0.0

Tura - use laravel named routes in your javascript.

  Sources   Download

MIT

The Requires

 

by Jack Hannigan Popp

29/08 2014

1.1

1.1.0.0

Tura - use laravel named routes in your javascript.

  Sources   Download

MIT

The Requires

 

by Jack Hannigan Popp

29/08 2014

1.0

1.0.0.0

  Sources   Download

The Requires

 

by Jack Hannigan Popp