public function mapApiRoutes(Router $router)
    {
        $permissionPrefix = $this->routeHelper->getPermissionPrefixForModelSlug(
            $this->getModelSlug()
        );

        $router->group(
            [
                'prefix'     => $this->getRoutePrefix(),
                'as'         => $this->getRouteNamePrefix(),
                'middleware' => [ cms_mw_permission("{$permissionPrefix}*") ],
            ],
            function (Router $router) use ($permissionPrefix) {

                $controller = $this->getModelApiController();

                $router->get('/', [
                    'as'   => 'index',
                    'uses' => $controller . '@index',
                ]);

                $router->get('create', [
                    'as'         => 'create',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}create")],
                    'uses'       => $controller . '@create',
                ]);

                $router->post('/', [
                    'as'         => 'store',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}create")],
                    'uses'       => $controller . '@store',
                ]);

                $router->get('{key}', [
                    'as'   => 'show',
                    'uses' => $controller . '@show',
                ]);

                $router->get('{key}/edit', [
                    'as'         => 'edit',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@edit',
                ]);

                $router->put('{key}', [
                    'as'         => 'update',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@update',
                ]);

                $router->delete('{key}', [
                    'as'         => 'destroy',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}delete")],
                    'uses'       => $controller . '@destroy',
                ]);
            }
        );
    }
public function mapApiRoutes(Router $router)
    {
        $permissionPrefix = $this->routeHelper->getPermissionPrefixForModelSlug(
            $this->getModelSlug()
        );

        $router->group(
            [
                'prefix'     => $this->getRoutePrefix(),
                'as'         => $this->getRouteNamePrefix(),
                'middleware' => [ cms_mw_permission("{$permissionPrefix}*") ],
            ],
            function (Router $router) use ($permissionPrefix) {

                $controller = $this->getModelApiController();

                $router->get('/', [
                    'as'   => 'index',
                    'uses' => $controller . '@index',
                ]);

                $router->get('create', [
                    'as'         => 'create',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}create")],
                    'uses'       => $controller . '@create',
                ]);

                $router->post('/', [
                    'as'         => 'store',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}create")],
                    'uses'       => $controller . '@store',
                ]);

                $router->get('{key}', [
                    'as'   => 'show',
                    'uses' => $controller . '@show',
                ]);

                $router->get('{key}/edit', [
                    'as'         => 'edit',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@edit',
                ]);

                $router->put('{key}', [
                    'as'         => 'update',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@update',
                ]);

                $router->delete('{key}', [
                    'as'         => 'destroy',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}delete")],
                    'uses'       => $controller . '@destroy',
                ]);
            }
        );
    }
public function mapApiRoutes ( Router $ router ) { $ permissionPrefix = $ this -> routeHelper -> getPermissionPrefixForModelSlug ( $ this -> getModelSlug ( ) ) ; $ router -> group ( [ 'prefix' => $ this -> getRoutePrefix ( ) , 'as' => $ this -> getRouteNamePrefix ( ) , 'middleware' => [ cms_mw_permission ( "{$permissionPrefix}*" ) ] , ] , function ( Router $ router ) use ( $ permissionPrefix ) { $ controller = $ this -> getModelApiController ( ) ; $ router -> get ( '/' , [ 'as' => 'index' , 'uses' => $ controller . '@index' , ] ) ; $ router -> get ( 'create' , [ 'as' => 'create' , 'middleware' => [ cms_mw_permission ( "{$permissionPrefix}create" ) ] , 'uses' => $ controller . '@create' , ] ) ; $ router -> post ( '/' , [ 'as' => 'store' , 'middleware' => [ cms_mw_permission ( "{$permissionPrefix}create" ) ] , 'uses' => $ controller . '@store' , ] ) ; $ router -> get ( '{key}' , [ 'as' => 'show' , 'uses' => $ controller . '@show' , ] ) ; $ router -> get ( '{key}/edit' , [ 'as' => 'edit' , 'middleware' => [ cms_mw_permission ( "{$permissionPrefix}edit" ) ] , 'uses' => $ controller . '@edit' , ] ) ; $ router -> put ( '{key}' , [ 'as' => 'update' , 'middleware' => [ cms_mw_permission ( "{$permissionPrefix}edit" ) ] , 'uses' => $ controller . '@update' , ] ) ; $ router -> delete ( '{key}' , [ 'as' => 'destroy' , 'middleware' => [ cms_mw_permission ( "{$permissionPrefix}delete" ) ] , 'uses' => $ controller . '@destroy' , ] ) ; } ) ; }
Generates API routes for the module given a contextual router instance.
Note that the module is responsible for ACL-checks, including route-based.

@param Router $router
Generates API routes for the module given a contextual router instance . Note that the module is responsible for ACL - checks including route - based .