当前位置: 首页>>代码示例>>PHP>>正文


PHP Theme::where方法代码示例

本文整理汇总了PHP中Theme::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::where方法的具体用法?PHP Theme::where怎么用?PHP Theme::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Theme的用法示例。


在下文中一共展示了Theme::where方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getByLabel

 public function getByLabel($label)
 {
     $theme = \Theme::where('label', '=', $label)->first();
     if (!empty($theme)) {
         return $theme->toArray();
     }
     return $theme;
 }
开发者ID:jalbertbowden,项目名称:core,代码行数:8,代码来源:ThemeRepository.php

示例2: installTheme

 public function installTheme($name)
 {
     $is_installed = Theme::where('name', '=', $name)->get() == NULL;
     if ($is_installed) {
         return Redirect::back()->with(['notice' => 'Theme is already installed']);
     }
     $theme = new Theme();
     $theme->name = $name;
     $theme->path = "assets/themes/{$name}";
     $theme->active = false;
     $theme->save();
     return Redirect::back()->with(['notice' => 'Bootstrap Theme Updated']);
 }
开发者ID:vanderlin,项目名称:Gear2,代码行数:13,代码来源:AdminController.php

示例3: activeTheme

 public static function activeTheme()
 {
     return Theme::where('active', '=', '1')->first();
 }
开发者ID:vanderlin,项目名称:Gear2,代码行数:4,代码来源:Theme.php

示例4: postOption

 /**
  * post All Option in base
  *
  * @return Response
  */
 public function postOption()
 {
     //Making adaptive rules for site_name
     $site_name_rules = array();
     $site_name_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'site_name_') !== false) {
             $site_name_rules[$k] = Config::get('validator.admin.option_site_name');
             $site_name_locales[] = mb_substr($k, strlen('site_name_'), strlen($k) - strpos($k, 'site_name_'));
         }
     }
     //Making adaptive rules for social_title
     $social_title_rules = array();
     $social_title_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'social_title_') !== false) {
             $social_title_rules[$k] = Config::get('validator.admin.option_social_title');
             $social_title_locales[] = mb_substr($k, strlen('social_title_'), strlen($k) - strpos($k, 'social_title_'));
         }
     }
     //Making adaptive rules for social_description
     $social_description_rules = array();
     $social_description_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'social_description_') !== false) {
             $social_description_rules[$k] = Config::get('validator.admin.option_social_description');
             $social_description_locales[] = mb_substr($k, strlen('social_description_'), strlen($k) - strpos($k, 'social_description_'));
         }
     }
     $rules = array_merge($site_name_rules, $social_title_locales, $social_description_locales, Config::get('validator.admin.option'));
     // Validate the inputs
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         //Themes
         $activeThemePublic = Theme::where('type', 'public')->where('active', 1)->first();
         $activeThemeAdmin = Theme::where('type', 'admin')->where('active', 1)->first();
         //Change or not?
         if ($activeThemePublic->id != Input::get('theme_public')) {
             $activeThemePublic->active = false;
             $activeThemePublic->save();
             $newThemePublic = Theme::find(Input::get('theme_public'));
             $newThemePublic->active = true;
             $newThemePublic->save();
         }
         if ($activeThemeAdmin->id != Input::get('theme_admin')) {
             $activeThemeAdmin->active = false;
             $activeThemeAdmin->save();
             $newThemeAdmin = Theme::find(Input::get('theme_public'));
             $newThemeAdmin->active = true;
             $newThemeAdmin->save();
         }
         //Delete Cache
         Cache::forget('DB_ThemeByType');
         //Options
         $options = Option::all();
         foreach ($options as $option) {
             if ($option->key == "site_url") {
                 $option->value = Input::get('site_url');
             }
             if ($option->key == "cover_path") {
                 $option->value = Input::get('cover_path');
             }
             if ($option->key == "admin_email") {
                 $option->value = Input::get('admin_email');
             }
             if ($option->key == "analytics") {
                 $option->value = Input::get('analytics');
             }
             if ($option->key == "i18n_site_name") {
                 //Update translations
                 foreach ($site_name_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('site_name_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_site_name_update_error'));
                     }
                 }
             }
             if ($option->key == "i18n_social_title") {
                 //Update translations
                 foreach ($social_title_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('social_title_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_social_title_update_error'));
                     }
                 }
             }
             if ($option->key == "i18n_social_description") {
                 //Update translations
                 foreach ($social_description_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('social_description_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_social_description_update_error'));
                     }
                 }
             }
             $option->save();
         }
//.........这里部分代码省略.........
开发者ID:Metrakit,项目名称:dynamix,代码行数:101,代码来源:AdminController.php


注:本文中的Theme::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。