PHP code example of eusonlito / laravel-simple-route
1. Go to this page and download the library: Download eusonlito/laravel-simple-route library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eusonlito / laravel-simple-route example snippets
'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}'
];