Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eusonlito/laravel-simpleroute
https://github.com/eusonlito/laravel-simpleroute
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/eusonlito/laravel-simpleroute
- Owner: eusonlito
- Created: 2015-04-22T22:13:33.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2015-08-08T08:44:25.000Z (over 9 years ago)
- Last Synced: 2024-10-18T04:24:00.729Z (26 days ago)
- Language: PHP
- Size: 191 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel 5 SimpleRoute
Package to generate simple multilanguage routes to Laravel
## Installation
Begin by installing this package through Composer.
```js
{
"require": {
"eusonlito/laravel-simple-route": "0.*"
}
}
```### SimpleRoute installation
#### config/app.php
```php
'locales' => ['en', 'es', 'fr', 'it'],'aliases' => [
'...',
'SimpleRoute' => 'Eusonlito\LaravelSimpleRoute\SimpleRoute',
];
```#### app/Http/routes.php
```php
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`
});
});
```#### resources/lang/en/routes.php
```php
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}'
];
```#### resources/lang/es/routes.php
```php
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}'
];
```