當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。