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


PHP model::update方法代码示例

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


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

示例1: create

 /**
  * Creates a node providing its internal type value. Doesn't check parent node existence.
  * @param {String} $type text type for the new node
  * @returns {Integer} the new node id on success, false otherwise
  */
 static function create($keys)
 {
     $query = "INSERT INTO node ( ) VALUES ( );";
     if ($result = mysql_query($query)) {
         $id = mysql_insert_id();
         model::update($id, $keys);
         return $id;
     }
     return $result;
 }
开发者ID:remyla,项目名称:damas-core,代码行数:15,代码来源:model.php

示例2: postEdit

 public function postEdit($id, ContactFormRequest $request)
 {
     $request->merge(['id' => $id]);
     if ($this->model->update($request->all())) {
         Notification::container()->success(trans('contacts::global.update.success'));
         return Redirect::to('/admin/contacts/' . $id . '/edit');
     } else {
         Notification::container()->error(trans('contacts::global.update.error'));
         return Redirect::to('/admin/contacts/' . $id . '/edit');
     }
 }
开发者ID:khaledof,项目名称:brikaCms,代码行数:11,代码来源:AdminContactsController.php

示例3: batchUpdate

 public function batchUpdate()
 {
     $request = Request::instance();
     $content = $request->getContent();
     $items = json_decode($content);
     $result = array();
     if (!empty($items)) {
         foreach ($items as $item) {
             $updated = $this->model->update((array) $item);
             if ($updated) {
                 $result[] = $item;
             }
         }
     }
     return Response::json($result);
 }
开发者ID:khaledof,项目名称:brikaCms,代码行数:16,代码来源:ApiContactsController.php

示例4: update

 function update($array)
 {
     if ($array['f_user_password']) {
         // encode password before updating
         $array['f_user_password'] = $GLOBALS['auth']->encoder->Encrypt_Text($array['f_user_password']);
     }
     if (parent::update($array)) {
         if ($GLOBALS['site']->params['f_group_id'] == $this->conf['admin_group_id'] && $this->data['group_id'] != $this->conf['admin_group_id']) {
             // user group changed to Admin. remove any previous enabled secretaria
             $sql = "delete ";
             $sql .= "from ";
             $sql .= " {$this->conf['tb_usuarios_secretarias']} ";
             $sql .= "where ";
             $sql .= " user_id='{$this->id}' ";
             return $this->db->query($sql);
         } else {
             return TRUE;
         }
     } else {
         return FALSE;
     }
 }
开发者ID:vivaserver,项目名称:sys,代码行数:22,代码来源:usuario.php

示例5: upd

 public function upd(array $data = NULL)
 {
     $where = "id = " . $data['id'];
     return parent::update('clientes', $data, $where);
 }
开发者ID:LucasMMota,项目名称:estoque,代码行数:5,代码来源:clientesModel.php

示例6: version_increment

 /**
  * Increment the asset after a successful backup and commit sequence
  * @param {Integer} asset node index
  * @param {String} user message for the new version
  */
 static function version_increment($id, $message)
 {
     model::update($id, array("version" => model::getKey($id, 'version') + 1, "user" => getUser(), "text" => $message, "time" => time()));
     #global $assetsLCL;
     #if( !model::setKey( $id, "sha1", sha1_file( $assetsLCL . model::getKey( $id, 'file' ) ) ) )
     #	return false;
     return true;
 }
开发者ID:remyla,项目名称:damas-core,代码行数:13,代码来源:asset.php

示例7: updateEstoqueProduto

 public function updateEstoqueProduto($id_evento_cliente)
 {
     $model = new model();
     $resProdutoEstoque = $model->readSQL("SELECT " . "ep.id_evento, " . "ep.qtd_produto, " . "p.id_produto, " . "p.qtd_produto as qtd_estoque " . "FROM evento_cliente ec " . "LEFT JOIN evento_produto ep ON (ep.id_evento = ec.id_evento) " . "LEFT JOIN produto p ON (p.id_produto = ep.id_produto) " . "WHERE ec.id_evento_cliente = {$id_evento_cliente}");
     foreach ($resProdutoEstoque as $value) {
         $data['qtd_produto'] = $value['qtd_estoque'] + $value['qtd_produto'];
         $result = $model->update('produto', $data, "id_produto = '" . $value['id_produto'] . "'");
     }
 }
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:9,代码来源:participacaoController.php

示例8: header

         if (!$ret) {
             header('HTTP/1.1: 404 Not Found');
             exit;
         }
         echo json_encode(array($ret));
     } else {
         echo json_encode(model_json::multi(explode(",", arg("id"))));
     }
     break;
 case "update":
     if (is_null(arg('id')) || is_null(arg('keys'))) {
         header("HTTP/1.1: 400 Bad Request");
         echo "Bad command";
         exit;
     }
     $id = model::update(arg("id"), json_decode(arg("keys")));
     echo json_encode(model_json::node(arg("id"), 1, $NODE_TAG | $NODE_PRM));
     break;
 case "delete":
     if (is_null(arg('id'))) {
         header("HTTP/1.1: 400 Bad Request");
         echo "Bad command";
         exit;
     }
     if (!model::delete(arg("id"))) {
         header("HTTP/1.1: 409 Conflict");
         echo "delete Error, please change your values";
         exit;
     }
     break;
     /* other operations */
开发者ID:remyla,项目名称:damas-core,代码行数:31,代码来源:model.json.php

示例9: update

 public function update()
 {
     parent::update('presence', 'status');
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:4,代码来源:status.php

示例10: json_encode

            exit;
        }
        echo json_encode(array($ret));
    } else {
        echo json_encode(model_json::multi(explode(",", $_GET['id'])));
    }
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
    damas_service::allowed("model::update");
    if (!isset($_PUT['id']) || !isset($_PUT['keys']) || ($_PUT['id'] == '' || $_PUT['keys'] == '')) {
        header("HTTP/1.1: 400 Bad Request");
        echo "Bad command";
        exit;
    }
    $id = model::update($_PUT['id'], json_decode($_PUT['keys']));
    echo json_encode(model_json::node(arg("id"), 1, $NODE_TAG | $NODE_PRM));
    damas_service::log_event();
    exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
    damas_service::allowed("model::delete");
    if (!isset($_DELETE['id']) || $_DELETE['id'] == '') {
        header("HTTP/1.1: 400 Bad Request");
        echo "Bad command";
        exit;
    }
    if (!model::delete($_DELETE['id'])) {
        header("HTTP/1.1: 409 Conflict");
        echo "delete Error, please change your values";
        exit;
开发者ID:remyla,项目名称:damas-core,代码行数:31,代码来源:model.crud.php

示例11: setAction

 function setAction()
 {
     $model = new model();
     $model->table('seven_set');
     $data['start'] = strtotime($_POST['start']);
     $data['end'] = strtotime($_POST['end']);
     $data['rule'] = $_POST['rule'];
     if ($model->has(array('id' => 1))) {
         $rs = $model->update($data, array('id' => 1));
     } else {
         $rs = $model->insert($data);
     }
     if ($rs) {
         $this->json('操作成功');
     } else {
         $this->json('操作失败', 0);
     }
 }
开发者ID:eyblog,项目名称:mvc,代码行数:18,代码来源:signController.class.php

示例12: update

 /**
  * Update an entity by id
  *
  * @param $id
  * @param array $data
  * @return mixed
  */
 public function update($id, array $data)
 {
     return $this->model->update($data);
 }
开发者ID:kr85,项目名称:SpartaPark,代码行数:11,代码来源:AbstractEloquentRepository.php

示例13: json_encode

error_reporting(E_ERROR);
session_start();
if (!$_SESSION['name'] || !$_POST['guess'] || $_POST['guess'] !== md5(sha1($_SESSION['name'] . "wechat") . "youchat")) {
    echo "不合法的来路!";
    die;
}
//获取提交数据
$id = $_POST['id'];
$title = $_POST['title'];
$content = $_POST['content'];
$img = upload();
require "../model/model.php";
$news = new model("news");
//更新并返回结果
if ($news->update($id, $title, $content, $img)) {
    $data['status'] = 1;
    $data['msg'] = "更新成功";
} else {
    $data['status'] = 0;
    $data['msg'] = "更新失败";
}
echo json_encode($data);
//上传文件
function upload()
{
    if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/png") && $_FILES["file"]["size"] < 2000000) {
        if ($_FILES["file"]["error"] > 0) {
            //"Return Code: " . $_FILES["file"]["error"] . "<br />";
            return false;
        } else {
开发者ID:phpcyy,项目名称:static,代码行数:30,代码来源:edit.php

示例14: produto_delete

 public function produto_delete()
 {
     $id_evento = $this->getParam('id_evento');
     $id_produto = $this->getParam('id_produto');
     $dados['id_evento'] = $id_evento;
     $dados['id_produto'] = $id_produto;
     $dados['stat'] = 0;
     $model = new model();
     $model->update("evento_produto", $dados, "id_produto={$id_produto} AND id_evento={$id_evento} AND stat<>0");
     header('Location: /evento');
 }
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:11,代码来源:eventoController.php


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