Package Data | |
---|---|
Maintainer Username: | eusonlito |
Maintainer Contact: | lito@eordes.com (Lito) |
Package Create Date: | 2015-04-22 |
Package Last Update: | 2015-08-08 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 03:03:47 |
Package Statistics | |
---|---|
Total Downloads: | 107 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 4 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Package to generate simple multilanguage routes to Laravel
Begin by installing this package through Composer.
{
"require": {
"eusonlito/laravel-simple-route": "0.*"
}
}
'locales' => ['en', 'es', 'fr', 'it'],
'aliases' => [
'...',
'SimpleRoute' => 'Eusonlito\LaravelSimpleRoute\SimpleRoute',
];
SimpleRoute::get('web.index'); // Controller `Web` method `index`
SimpleRoute::get('articles.home'); // Controller `Articles` method `home`
SimpleRoute::get('articles.detail'); // Controller `Articles` method `detail`
SimpleRoute::get('users.logout'); // Controller `Users` method `logout`
SimpleRoute::group(['middleware' => 'guest'], function () {
SimpleRoute::any('users.login'); // Controller `Users` method `login`
SimpleRoute::any('users.register'); // Controller `Users` method `register`
});
SimpleRoute::group(['prefix' => 'users', 'middleware' => 'auth'], function () {
SimpleRoute::get('users.home'); // Controller `Users` method `home`
SimpleRoute::any('users.profile'); // Controller `Users` method `profile`
SimpleRoute::any('users.edit-profile'); // Controller `Users` method `editProfile`
SimpleRoute::group(['middleware' => 'admin'], function () {
SimpleRoute::any('users.articles.add'); // Controller `UsersArticles` method `add`
SimpleRoute::any('users.articles.edit'); // Controller `UsersArticles` method `edit`
SimpleRoute::delete('users.articles.delete'); // Controller `UsersArticles` method `delete`
});
});
return [
'web.index' => '/',
'articles.home' => '/articles',
'articles.detail' => '/article/{slug}',
'users' => '/users',
'users.register' => '/register',
'users.login' => '/login',
'users.logout' => '/logout',
'users.home' => '/home',
'users.profile' => '/profile',
'users.articles.add' => '/article/new',
'users.articles.edit' => '/article/edit/{slug}',
'users.articles.delete' => '/article/delete/{slug}'
];
return [
'web.index' => '/',
'articles.home' => '/articulos',
'articles.detail' => '/articulo/{slug}',
'users' => '/usuarios',
'users.register' => '/registro',
'users.login' => '/acceso',
'users.logout' => '/salir',
'users.home' => '/inicio',
'users.profile' => '/perfil',
'users.articles.add' => '/articulo/nuevo',
'users.articles.edit' => '/articulo/editar/{slug}',
'users.articles.delete' => '/articulo/borrar/{slug}'
];