app/maguttiCms/Providers/maguttiCmsServiceProvider.php
/**
     * Bootstrap any application services.
     *
     * @return void
     */
Bootstrap any application services.
@return void
Bootstrap any application services . @return void
public function boot()
    {
        view()->composer('*', function($view){
            $view_name = str_replace('.', '-', $view->getName());
            view()->share('view_name', $view_name);
        });
        view()->composer(['website/*','components/*'], ViewShareSettingComposer::class);
        Validator::extend('is_unique', function($attribute, $value, $parameters, $validator) {
            $model  = request()->segment(3);
            $config = config('maguttiCms.admin.list.section.' .$model);
            $id     = (request()->segment(4))?:null;
            if(getModelFromString($config['model'])::where($attribute,$value)->where('id','!=',$id)->count()) return false;
            return true;
        });
        Validator::extend(
            'recaptcha',
            'App\\maguttiCms\\Rules\\GoogleRecaptcha@passes'
        );
        Validator::extend(
            'field_locale',
            'App\\maguttiCms\\Rules\\FieldLocale@passes'
        );
    }
public function boot ( ) { view ( ) -> composer ( '*' , function ( $ view ) { $ view_name = str_replace ( '.' , '-' , $ view -> getName ( ) ) ; view ( ) -> share ( 'view_name' , $ view_name ) ; } ) ; view ( ) -> composer ( [ 'website/*' , 'components/*' ] , ViewShareSettingComposer :: class ) ; Validator :: extend ( 'is_unique' , function ( $ attribute , $ value , $ parameters , $ validator ) { $ model = request ( ) -> segment ( 3 ) ; $ config = config ( 'maguttiCms.admin.list.section.' . $ model ) ; $ id = ( request ( ) -> segment ( 4 ) ) ? : null ; if ( getModelFromString ( $ config [ 'model' ] ) :: where ( $ attribute , $ value ) -> where ( 'id' , '!=' , $ id ) -> count ( ) ) return false ; return true ; } ) ; Validator :: extend ( 'recaptcha' , 'App\\maguttiCms\\Rules\\GoogleRecaptcha@passes' ) ; Validator :: extend ( 'field_locale' , 'App\\maguttiCms\\Rules\\FieldLocale@passes' ) ; }
Bootstrap any application services.
Bootstrap any application services .
/*
        |--------------------------------------------------------------------------
        |  SHARE VARIABLES TO VIEWS
        |--------------------------------------------------------------------------
        */ /**
         *  Share  view name
         */ /*
         * share site_setting to fe views
         */ /*
        |--------------------------------------------------------------------------
        |  LARACMS VALIDATION CUSTOM DIRECTIVE
        |--------------------------------------------------------------------------
        */ /*
        |--------------------------------------------------------------------------
        |  BLADE CUSTOM DIRECTIVE
        |--------------------------------------------------------------------------
        */