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


PHP Data::create方法代码示例

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


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

示例1: addAction

 public function addAction()
 {
     $form = new DataForm();
     if ($form->isPosted()) {
         if ($form->isValidForAdd()) {
             $id = Data::create(["name" => Input::get("name"), "description" => Input::get("description"), "mobile" => Input::get("mobile"), "email" => Input::get("email"), "address" => Input::get("address"), "web" => Input::get("web"), "ranking" => 50])->id;
             $this->associateUser(Auth::user()->id, $id);
             return Redirect::route($this->routeAdd);
         }
         return Redirect::route($this->routeAdd)->withInput(["errors" => $form->getErrors()]);
         //die(var_dump($form->getErrors()));
         return Redirect::route($this->routeAdd)->withErrors($form->getErrors())->withInput();
     }
     return View::make($this->routeAdd, ["form" => $form, "HeaderTitle" => trans('addData.title')]);
 }
开发者ID:alejandromorg,项目名称:Inventario,代码行数:15,代码来源:DataController.php

示例2: addAction

 public function addAction()
 {
     $form = new ProductoForm();
     if ($form->isPosted()) {
         if ($form->isValidForAdd()) {
             $ID_INVENTARIO = Data::create(["ID_INVENTARIO" => Input::get("ID_INVENTARIO"), "ID_VENTA" => Input::get("ID_VENTA"), "ID_PRODUCTO" => Input::get("ID_PRODUCTO"), "ID_RUTA" => Input::get("ID_RUTA"), "NOMBRE_PRODUCTO" => Input::get("NOMBRE_PRODUCTO"), "DISPONIBLE" => 1])->ID_INVENTARIO;
             //$this->associateUser(Auth::user()->id,$id);
             return Redirect::route($this->routeAdd);
         }
         return Redirect::route($this->routeAdd)->withInput(["errors" => $form->getErrors()]);
         //die(var_dump($form->getErrors()));
         return Redirect::route($this->routeAdd)->withErrors($form->getErrors())->withInput();
     }
     return View::make($this->routeAdd, ["form" => $form, "HeaderTitle" => trans('addData.title')]);
 }
开发者ID:alejandromorg,项目名称:Inventario,代码行数:15,代码来源:UnidadEmpaqueController.php

示例3:

       
      	<nav class="navbar navbar-full navbar-inverse">
		<div class="navbar-brand center-block"> 
			<h3>php :: mon </h3>
		</div> 
		
	</nav>

  <div class="container">
  
<?php 
if ($_POST) {
    $product->name = $_POST['name'];
    $product->url = $_POST['url'];
    $product->host = $_POST['host'];
    if ($product->create()) {
        ?>
<div class="alert alert-success alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>Success!</strong> <a href="index.php">View Data</a>.
</div>
<?php 
    } else {
        ?>
<div class="alert alert-danger alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>Fail!</strong></div>
<?php 
    }
}
?>
开发者ID:andrija1987,项目名称:phpmon,代码行数:30,代码来源:add.php

示例4: checkIntegrity

 /**
  * checkIntegrity
  * --------------------------------------------------
  * Checking a widget's overall integrity,
  * setting state accordingly.
  * --------------------------------------------------
  */
 protected function checkIntegrity($commit = TRUE)
 {
     // Data integrity validation.
     if ($this instanceof iDataWidget) {
         // Exception variables.
         $valid = TRUE;
         $save = FALSE;
         try {
             $this->checkData();
         } catch (MissingData $e) {
             // Data object is not present but it should be.
             $valid = FALSE;
             $save = TRUE;
             $data = Data::create(array('raw_value' => $this->createDataScheme()));
             $this->data()->associate($data);
             $data->save();
         } catch (InvalidData $e) {
             // Invalid data found in db, doing cleanup.
             $valid = FALSE;
             $save = TRUE;
             $this->data->raw_value = $this->createDataScheme();
             $this->data->save();
         } catch (EmptyData $e) {
             // Data not yet populated.
             $valid = FALSE;
         }
         // Updating widget state accordingly.
         if (!$valid && $this->state == 'active') {
             $this->state = 'missing_data';
             $save = TRUE;
         } elseif ($valid && $this->state == 'missing_data') {
             // Valid and was missing_data -> set to active.
             $this->state = 'active';
             $save = TRUE;
         }
         if ($save && $commit) {
             $this->save();
         }
     }
 }
开发者ID:neraunzaran,项目名称:fruit-dashboard,代码行数:47,代码来源:Widget.php


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