app/Providers/AppServiceProvider.php
/**
     * Bootstrap any application services.
     *
     * @return void
     */
Bootstrap any application services.
@return void
Bootstrap any application services . @return void
public function boot()
    {
       $common_cates_data = Cates::where('path','!=','0')->get();
        $common_links_data = Links::where('lstate','1')->get();
        $common_configs_data = Config::first();
        $common_shopcars_data = ShopCars::get();
        if($common_shopcars_data){
            view()->share(
            [
                'common_cates_data'   => $common_cates_data,
                'common_links_data'   => $common_links_data,
                'common_configs_data' => $common_configs_data,
                'common_shopcars_data'=> $common_shopcars_data,
            ]
            );
        }else{
            view()->share(
                [
                    'common_cates_data'  => $common_cates_data,
                    'common_links_data'  => $common_links_data,
                    'common_configs_data'=> $common_configs_data,
                ]
            );
        }
    }
public function boot ( ) { $ common_cates_data = Cates :: where ( 'path' , '!=' , '0' ) -> get ( ) ; $ common_links_data = Links :: where ( 'lstate' , '1' ) -> get ( ) ; $ common_configs_data = Config :: first ( ) ; $ common_shopcars_data = ShopCars :: get ( ) ; if ( $ common_shopcars_data ) { view ( ) -> share ( [ 'common_cates_data' => $ common_cates_data , 'common_links_data' => $ common_links_data , 'common_configs_data' => $ common_configs_data , 'common_shopcars_data' => $ common_shopcars_data , ] ) ; } else { view ( ) -> share ( [ 'common_cates_data' => $ common_cates_data , 'common_links_data' => $ common_links_data , 'common_configs_data' => $ common_configs_data , ] ) ; } }
Bootstrap any application services.
Bootstrap any application services .
// 共享的分类数据 //友情链接数据 //网站配置数据 //购物车所有数据 //共享数据