本文整理汇总了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');
}
示例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));
}
示例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');
}
示例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") {
示例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();
}