當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BlockType::all方法代碼示例

本文整理匯總了PHP中BlockType::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP BlockType::all方法的具體用法?PHP BlockType::all怎麽用?PHP BlockType::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BlockType的用法示例。


在下文中一共展示了BlockType::all方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initCache

    public function initCache()
    {
        // !!! DATABASE CACHE !!!
        //Cache Model::Menu
        //Cache::forget('DB_Menu');
        /*Cache::rememberForever('DB_Menu', function()
        		{
        		    return Menu::where('parent_id','=',0)->orderBy('order','ASC')->get();
        		});*/
        //Cache Model::Locale
        Cache::rememberForever('DB_LocaleFrontEnable', function () {
            //Get all data in database
            $locales = Locale::where('enable', '=', 1)->where('is_publish', '=', 1)->get();
            //Preapre data to extract by id
            $data = array();
            foreach ($locales as $l) {
                $data[] = $l->id;
            }
            return $data;
        });
        //Cache Model::Nav
        Cache::rememberForever('DB_Nav', function () {
            return Nav::where('parent_id', '=', 0)->orderBy('order', 'ASC')->get();
        });
        //Cache Model::Resource('name')
        Cache::rememberForever('DB_AdminResourceName', function () {
            //Get all data in database
            $resources = Resource::where('in_admin_ui', '=', 1)->get();
            //Preapre data to extract by id
            $data = array();
            foreach ($resources as $r) {
                $data[$r->id] = $r->name;
            }
            return $data;
        });
        Cache::rememberForever('DB_AdminResource', function () {
            //Get all data in database
            return Resource::where('in_admin_ui', '=', 1)->get();
        });
        Cache::rememberForever('DB_AdminResourceNavigable', function () {
            //Get all data in database
            return Resource::where('navigable', '=', 1)->where('in_admin_ui', '=', 1)->get();
        });
        // Get all Locales enableds in the table
        Cache::rememberForever('DB_LocalesEnabled', function () {
            return Locale::where('enable', 1)->where('is_publish', 1)->get();
        });
        Cache::rememberForever('DB_AdminBlockTypes', function () {
            //Get all data in database
            return BlockType::all();
        });
        //Cache Model::Mosaique('name')
        //Cache::forget('DB_Mosaique');
        /*Cache::rememberForever('DB_Mosaique', function()
        		{
        			//Get all data in database
        		    return Mosaique::all();
        		});*/
        //Cache Model::Option
        Cache::rememberForever('DB_Option', function () {
            return Option::all();
        });
        //Cache Model::Urls
        Cache::rememberForever('DB_Urls', function () {
            $data = DB::select('
		    	SELECT translations.i18n_id , translations.text , translations.locale_id 
				FROM translations
				INNER JOIN i18n_types ON i18n_types.name = ?
				INNER JOIN i18n ON i18n.i18n_type_id = i18n_types.id AND translations.i18n_id = i18n.id
		    ', array('url'));
            //$data = Translation::i18n()->where('i18n_type_id','=',I18nType::where('name','=','url')->first()->id)->get
            $datas = array();
            foreach ($data as $d) {
                $datas[] = array('i18n_id' => $d->i18n_id, 'url' => $d->text, 'locale_id' => $d->locale_id);
            }
            return $datas;
        });
    }
開發者ID:Metrakit,項目名稱:dynamix,代碼行數:78,代碼來源:Cachr.php


注:本文中的BlockType::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。