当前位置: 首页>>代码示例>>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;未经允许,请勿转载。