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


PHP Style::save方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Style();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Style'])) {
         $model->attributes = $_POST['Style'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:yunsite,项目名称:my-advertise,代码行数:17,代码来源:StyleController.php

示例2: run

 public function run()
 {
     $row = 0;
     if (($handle = fopen(storage_path() . "/csvs/styles.csv", "r")) !== FALSE) {
         while (($data = fgetcsv($handle)) !== FALSE) {
             $row++;
             if ($row > 1) {
                 try {
                     $style = new Style();
                     $style->style_name = $data[2];
                     // $beer->beer_id = $data[0];
                     $style->save();
                 } catch (Exception $e) {
                 }
             }
         }
         fclose($handle);
     }
 }
开发者ID:hopshoppub,项目名称:hopshop.dev,代码行数:19,代码来源:StylesTableSeeder.php

示例3: saveStyle

 /**
  * Submit style form
  */
 public function saveStyle()
 {
     if (Input::get('style_id') != null) {
         //edit style
         $style = Style::find(Input::get('style_id'));
     } else {
         //create style
         $style = new Style();
     }
     if (Input::get('parent_style') != null) {
         $parent_style = Style::where('name', Input::get('parent_style'))->first();
         if ($parent_style) {
             $parent_style_id = $parent_style->id;
         }
     } else {
         $parent_style_id = null;
     }
     $style->name = Input::get('name');
     $style->description = Input::get('description');
     $style->style_id = $parent_style_id;
     $style->wikipedia_url = Input::get('wikipedia');
     $style->save();
     return Redirect::back()->withMessage('Style created correctly');
 }
开发者ID:andreuramos,项目名称:beers,代码行数:27,代码来源:DashboardController.php

示例4: changeStyle

 function changeStyle()
 {
     $current_user = new User();
     $current_user->createFromID($this->getCurrentUserID());
     $deckid = $_POST['deck'];
     $deck = new Deck();
     $deck->id = $deckid;
     $deck->title = $deck->getTitle();
     $deck->slug_title = $deck->sluggify($deck->title);
     $styleid = isset($_POST['id']) ? $_POST['id'] : 1;
     if (isset($_POST['submit'])) {
         $response = 1;
         $s = $_POST['style'];
         if (isset($_POST['new'])) {
             $s['based_on'] = $s['id'];
             unset($s['id']);
             $new_style = new Style();
             $new_style->name = $s['name'];
             if (!$s['name']) {
                 header('Location: ' . BASE_PATH . 'error/400');
             }
             $new_style->user_id = $current_user->id;
             $new_style->based_on = $s['based_on'];
             $new_style->css = $s['css'];
             $new_style->scss_varfunc = $s['scss_varfunc'];
             $new_style->scss = $s['scss'];
             $new_style->comment = $s['comment'];
             $new_style->create();
             $styleid = $new_style->id;
         } else {
             $current_style = new Style();
             $current_style->createFromID($s['id']);
             $current_style->name = $s['name'];
             //$current_style->user_id = $current_user->id;
             //$current_style->based_on = $s ['based_on'];
             $current_style->css = $s['css'];
             $current_style->scss_varfunc = $s['scss_varfunc'];
             $current_style->scss = $s['scss'];
             $current_style->comment = $s['comment'];
             $current_style->save();
             $styleid = $s['id'];
         }
     }
     header('Location: style/' . $styleid . '/deck/' . $deckid . '_' . $deck->slug_title);
 }
开发者ID:TBoonX,项目名称:SlideWiki,代码行数:45,代码来源:MainController.php


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