src/Charcoal/Admin/AdminModule.php
public function setup()
    {
        // Hack: skip if the request does not start with '/admin'
        $container = $this->app()->getContainer();
        if (substr(ltrim($container['request']->getUri()->getPath(), '/'), 0, 5) !== 'admin') {
            return $this;
        }

        // A session is necessary for the admin module
        if (session_id() === '') {
            session_start();
        }
        $container->register(new AdminServiceProvider());

        $module = $this;
        $container['charcoal/admin/module'] = function () use ($module) {
            return $module;
        };

        $adminConfig = $container['admin/config'];

        $this->setConfig($adminConfig);

        $groupIdent = '/'.trim($adminConfig['base_path'], '/');

        // Add the route group
        $this->app()->group($groupIdent, 'charcoal/admin/module:setupRoutes')
                    ->add('charcoal/admin/module:setupHandlers');

        return $this;
    }
public function setup()
    {
        // Hack: skip if the request does not start with '/admin'
        $container = $this->app()->getContainer();
        if (substr(ltrim($container['request']->getUri()->getPath(), '/'), 0, 5) !== 'admin') {
            return $this;
        }

        // A session is necessary for the admin module
        if (session_id() === '') {
            session_start();
        }
        $container->register(new AdminServiceProvider());

        $module = $this;
        $container['charcoal/admin/module'] = function () use ($module) {
            return $module;
        };

        $adminConfig = $container['admin/config'];

        $this->setConfig($adminConfig);

        $groupIdent = '/'.trim($adminConfig['base_path'], '/');

        // Add the route group
        $this->app()->group($groupIdent, 'charcoal/admin/module:setupRoutes')
                    ->add('charcoal/admin/module:setupHandlers');

        return $this;
    }
public function setup ( ) { // Hack: skip if the request does not start with '/admin' $ container = $ this -> app ( ) -> getContainer ( ) ; if ( substr ( ltrim ( $ container [ 'request' ] -> getUri ( ) -> getPath ( ) , '/' ) , 0 , 5 ) !== 'admin' ) { return $ this ; } // A session is necessary for the admin module if ( session_id ( ) === '' ) { session_start ( ) ; } $ container -> register ( new AdminServiceProvider ( ) ) ; $ module = $ this ; $ container [ 'charcoal/admin/module' ] = function ( ) use ( $ module ) { return $ module ; } ; $ adminConfig = $ container [ 'admin/config' ] ; $ this -> setConfig ( $ adminConfig ) ; $ groupIdent = '/' . trim ( $ adminConfig [ 'base_path' ] , '/' ) ; // Add the route group $ this -> app ( ) -> group ( $ groupIdent , 'charcoal/admin/module:setupRoutes' ) -> add ( 'charcoal/admin/module:setupHandlers' ) ; return $ this ; }
Charcoal Administration Setup.

This module is bound to the `/admin` URL.

## Provides

- `charcoal/admin/module` An instance of this module
- Exact type: `\Charcoal\Admin\AdminModule`
- which implements `\Charcoal\Module\ModuleInterface`

## Dependencies
- `charcoal/config` Provided by \Charcoal\CharcoalModule

@return AdminModule Chainable
Charcoal Administration Setup .