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


PHP Services::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), array('name' => 'required|min:3|unique:services,name'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $pets = Input::get('pets');
     $service = new Services();
     $service->name = Input::get('name');
     $service->save();
     $service->serviciablePets()->attach(array_flatten($pets));
     return Redirect::to('services');
 }
开发者ID:pramodvkadam,项目名称:petService,代码行数:18,代码来源:ServiceController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Services();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Services'])) {
         $model->attributes = $_POST['Services'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:mudiman,项目名称:yiirestintegrated,代码行数:17,代码来源:ServicesController.php

示例3: getSave

 public function getSave()
 {
     $id = Input::get('id');
     if ($id) {
         $services = Services::find($id);
         $services->name = Input::get('name');
         $services->price = Input::get('price');
         $services->save();
         Session::flash('message', 'The records are updated successfully');
     } else {
         $services = new Services();
         $services->name = Input::get('name');
         $services->price = Input::get('price');
         $services->save();
         Session::flash('message', 'The records are inserted successfully');
     }
     return Redirect::to('services');
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:18,代码来源:ServicesController.php

示例4: flash

setvar("ServiceTypes", $typeoption->get_cache_type("service_type"));
if (isset($_POST['save_client'])) {
    if (!empty($_POST['data']['setting'])) {
        $updated = $setting->replace($_POST['data']['setting'], 1);
        if ($updated) {
            $cache->writeCache("setting", "setting");
            flash("success");
        }
    }
    flash();
}
if (isset($_POST['save']) && !empty($_POST['data']['service'])) {
    $vals = array();
    $vals = $_POST['data']['service'];
    $vals['modified'] = $time_stamp;
    $result = $service->save($vals, "update", $_POST['id']);
    if (!empty($vals['revert_content'])) {
        $datas = array("actor" => $adminer_info['last_name'], "action" => L("feed_revert", "tpl"), "do" => L("feed_problem", "tpl"), "subject" => '<a href="index.php?do=service&action=detail&id=' . $_POST['id'] . '">' . $vals['title'] . '</a>');
        $sql = "INSERT INTO {$tb_prefix}feeds (type_id,type,member_id,username,data,created,modified,revert_date) VALUE ('1','service'," . $current_adminer_id . ",'" . $adminer_info['last_name'] . "','" . serialize($datas) . "'," . $time_stamp . "," . $time_stamp . "," . $time_stamp . ")";
        $pdb->Execute($sql);
    }
    if (!$result) {
        flash();
    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "client") {
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:service.php

示例5: actionAddService

 public function actionAddService()
 {
     $id = (int) Yii::app()->request->getParam('id', 0);
     $modelRequest = $this->isReal($id)['model'];
     $eventName = Yii::app()->request->getParam('m', false);
     $returnArray = array();
     $status = false;
     $msg = '';
     if ($eventName) {
         $model = new Services();
         $model->name = $eventName;
         $model->created_by = Yii::app()->user->getInfo();
         if ($modelRequest != null) {
             $model->request_id = $modelRequest->id;
         }
         if ($model->save()) {
             $status = true;
             $msg = 'Successfully done';
             //                $criteria = new CDbCriteria();
             //                $criteria->addCondition('created_by = '.Yii::app()->user->getInfo());
             //                $criteria->addCondition('id != '.$model->id);
             //                $modelArray = Services::model()->findAll($criteria);
             //                foreach ($modelArray as $model) {
             //                    $model->request_id = null;
             //                    $model->save();
             //                }
         } else {
             $msg = $model->getErrors();
         }
     }
     $returnArray['status'] = $status;
     $returnArray['msg'] = $msg;
     header('Content-Type: application/json');
     $return = json_encode($returnArray);
     echo $return;
     Yii::app()->end();
 }
开发者ID:VanyaAvchyan,项目名称:Pol,代码行数:37,代码来源:ApiController.php


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