protected function registerBlade5_1()
    {
        // role
        Blade::directive('role', function ($expression) {
            return "<?php if (Auth::check() && Auth::user()->is{$expression}): ?>";
        });

        Blade::directive('endrole', function () {
            return "<?php endif; ?>";
        });

        // permission
        Blade::directive('permission', function ($expression) {
            return "<?php if (Auth::check() && Auth::user()->can{$expression}): ?>";
        });

        Blade::directive('endpermission', function () {
            return "<?php endif; ?>";
        });
    }
protected function registerBlade5_1()
    {
        // role
        Blade::directive('role', function ($expression) {
            return "<?php if (Auth::check() && Auth::user()->is{$expression}): ?>";
        });

        Blade::directive('endrole', function () {
            return "<?php endif; ?>";
        });

        // permission
        Blade::directive('permission', function ($expression) {
            return "<?php if (Auth::check() && Auth::user()->can{$expression}): ?>";
        });

        Blade::directive('endpermission', function () {
            return "<?php endif; ?>";
        });
    }
protected function registerBlade5_1 ( ) { // role Blade :: directive ( 'role' , function ( $ expression ) { return "<?php if (Auth::check() && Auth::user()->is{$expression}): ?>" ; } ) ; Blade :: directive ( 'endrole' , function ( ) { return "<?php endif; ?>" ; } ) ; // permission Blade :: directive ( 'permission' , function ( $ expression ) { return "<?php if (Auth::check() && Auth::user()->can{$expression}): ?>" ; } ) ; Blade :: directive ( 'endpermission' , function ( ) { return "<?php endif; ?>" ; } ) ; }
Register Blade Template Extensions for >= L5.1
Register Blade Template Extensions for > = L5 . 1