PHP code example of five-say / laravel-route-group

1. Go to this page and download the library: Download five-say/laravel-route-group 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/ */

    

five-say / laravel-route-group example snippets


'providers' => array(
    ...
    'FiveSay\LaravelRouteGroup\ServiceProvider',
),
'aliases' => array(
    ...
    'RouteGroup' => 'FiveSay\LaravelRouteGroup\Facade',
),

RouteGroup::make()->controller('AdminController')->go(function ($route) {
    $route->get('/')->as('admin')->uses('getIndex');
});

RouteGroup::make()->controller('AdminController')->go(function ($route) {
    $route->get('/')->as('admin')->uses('getIndex');
})->dd();

RouteGroup::make('admin')->as('admin')->before('auth')
    ->controller('AdminController')->go(function ($route) {
        $route->index(  )
              ->create( )
              ->store(  )
              ->edit(   )
              ->update( )
              ->destroy();
    })->dd();

RouteGroup::make('admin')->as('admin')->before('auth')
    ->controller('AdminController')->go(function ($route) {
        $route->index(  )
              ->create( )->beforeClear()
              ->store(  )->before('more')->before('more2|more3')
              ->edit(   )->beforeOnly('myself')
              ->update( );
        $route->delete('{id}')->as('destroy')->uses('destroy');
    })->dd();