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


PHP Currency::save方法代碼示例

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


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

示例1: fakeCurrency

 protected function fakeCurrency()
 {
     $fakeCurrency = new Currency();
     $fakeCurrency->currency_code = "USD";
     $fakeCurrency->currency_name = "Dollar";
     $fakeCurrency->save();
     return $fakeCurrency;
 }
開發者ID:boylee1111,項目名稱:Reservation,代碼行數:8,代碼來源:DbTestCase.php

示例2: actionCreate

 /**
  * Creates a new Currency model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Currency();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->goBack();
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:Nhassa,項目名稱:budget,代碼行數:14,代碼來源:CurrencyController.php

示例3: actionCreate

 /**
  * Creates a new Currency model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Currency();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         $billing = ArrayHelper::map(Billing::find()->asArray()->all(), 'id', 'name');
         return $this->render('create', ['model' => $model, 'billing' => $billing]);
     }
 }
開發者ID:zinchenkomax,項目名稱:moneychanger,代碼行數:15,代碼來源:CurrencyController.php

示例4: actionCreate

 /**
  * Creates a new Currency model.
  * If creation is successful, the browser will be redirected to the 'index' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Currency();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash("Currency-success", Yii::t("app", "Currency successfully created"));
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:ercling,項目名稱:economizzer,代碼行數:15,代碼來源:CurrencyController.php

示例5: initCurrenciesToDb

 private function initCurrenciesToDb()
 {
     for ($day = 3000; $day > 0; $day--) {
         $currency = new Currency();
         $date = date('Y-m-d', strtotime('-' . $day . ' day'));
         $currency->date = $date;
         $currency->usd = $this->getCurrencyForDate($date);
         $currency->save();
         echo $day . PHP_EOL;
     }
 }
開發者ID:sasik-github,項目名稱:currency,代碼行數:11,代碼來源:MyCommand.php

示例6: save

 public function save($request)
 {
     $currencies = new Currency();
     $currencies->currency = $request->input('currency');
     $currencies->symbol = $request->input('symbol');
     if ($currencies->save()) {
         return $currencies->id;
     } else {
         return false;
     }
 }
開發者ID:iqbalmalik89,項目名稱:carpool,代碼行數:11,代碼來源:CurrencyRepository.php

示例7: store

 /**
  * @param Request $request
  * @param Course $course
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Request $request, Course $course)
 {
     $regex = '/^(?=.+)(?:[1-9]\\d*|0)?(?:\\.\\d+)?$/';
     $validator = Validator::make($request->all(), ['name' => 'required|string|max:255', 'course_purchase' => ['required', 'regex:' . $regex]]);
     if ($validator->fails()) {
         return redirect()->route('admin.course.create')->withErrors($validator->errors())->withInput();
     }
     $currency = new Currency();
     $currency->name = $request->name;
     $currency->save();
     $course->currency()->associate($currency);
     $course->fill($request->all());
     $course->save();
     return redirect()->route('admin.course.index');
 }
開發者ID:lyovkin,項目名稱:elcoinbank,代碼行數:20,代碼來源:AdminCourseController.php

示例8: exchangeRates

 public function exchangeRates()
 {
     $currency = new Currency();
     $url = 'https://api.privatbank.ua/p24api/pubinfo?exchange&coursid=3';
     $xml = new SimpleXMLElement($url, NULL, true);
     $eur = (array) $xml->row[0]->exchangerate['sale'];
     $rur = (array) $xml->row[1]->exchangerate['sale'];
     $usd = (array) $xml->row[2]->exchangerate['sale'];
     $currency->uan = 1;
     $currency->eur = $eur[0];
     $currency->rur = $rur[0];
     $currency->usd = $usd[0];
     $currency->date = 86400 * ceil(time() / 86400);
     if ($currency->save()) {
         return false;
     }
     return true;
 }
開發者ID:aiskimzhi,項目名稱:advert,代碼行數:18,代碼來源:Currency.php


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