src/HelperServiceProvider.php
public function register()
    {
        //register commands
        $this->commands([
            Commands\HelperMakeCommand::class,
        ]);

        //include the active package helpers
        foreach (config('helpers.package_helpers', []) as $activeHelper) {

            $file = __DIR__ . '/Helpers/' . $activeHelper . '.php';

            if (file_exists($file)) {
                require_once($file);
            }
        }

        //load custom helpers with a mapper
        if (count(config('helpers.custom_helpers', []))) {

            foreach (config('helpers.custom_helpers', []) as $customHelper) {

                $file = app_path() . '/' . $this->getHelpersDirectory() . '/' . $customHelper . '.php';

                if(file_exists($file)) {
                    require_once($file);
                }
            }
        }

        //load custom helpers automatically
        else {

            //include the custom helpers
            foreach (glob(app_path() . '/' . $this->getHelpersDirectory() . '/*.php') as $file) {
                require_once($file);
            }
        }
    }
public function register()
    {
        //register commands
        $this->commands([
            Commands\HelperMakeCommand::class,
        ]);

        //include the active package helpers
        foreach (config('helpers.package_helpers', []) as $activeHelper) {

            $file = __DIR__ . '/Helpers/' . $activeHelper . '.php';

            if (file_exists($file)) {
                require_once($file);
            }
        }

        //load custom helpers with a mapper
        if (count(config('helpers.custom_helpers', []))) {

            foreach (config('helpers.custom_helpers', []) as $customHelper) {

                $file = app_path() . '/' . $this->getHelpersDirectory() . '/' . $customHelper . '.php';

                if(file_exists($file)) {
                    require_once($file);
                }
            }
        }

        //load custom helpers automatically
        else {

            //include the custom helpers
            foreach (glob(app_path() . '/' . $this->getHelpersDirectory() . '/*.php') as $file) {
                require_once($file);
            }
        }
    }
public function register ( ) { //register commands $ this -> commands ( [ Commands \ HelperMakeCommand :: class , ] ) ; //include the active package helpers foreach ( config ( 'helpers.package_helpers' , [ ] ) as $ activeHelper ) { $ file = __DIR__ . '/Helpers/' . $ activeHelper . '.php' ; if ( file_exists ( $ file ) ) { require_once ( $ file ) ; } } //load custom helpers with a mapper if ( count ( config ( 'helpers.custom_helpers' , [ ] ) ) ) { foreach ( config ( 'helpers.custom_helpers' , [ ] ) as $ customHelper ) { $ file = app_path ( ) . '/' . $ this -> getHelpersDirectory ( ) . '/' . $ customHelper . '.php' ; if ( file_exists ( $ file ) ) { require_once ( $ file ) ; } } } //load custom helpers automatically else { //include the custom helpers foreach ( glob ( app_path ( ) . '/' . $ this -> getHelpersDirectory ( ) . '/*.php' ) as $ file ) { require_once ( $ file ) ; } } }
register the service provider

@return void
register the service provider