本文整理汇总了PHP中Sample::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Sample::update方法的具体用法?PHP Sample::update怎么用?PHP Sample::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sample
的用法示例。
在下文中一共展示了Sample::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postStore
public function postStore()
{
$postData = Input::all();
$rules = array('userName' => 'required|min:5', 'userEmail' => 'required|email', 'userMobile' => 'required|min:10|numeric', 'userAddress1' => 'required', 'userAddress2' => 'required', 'userPincode' => 'required|min:6|numeric', 'userCity' => 'required', 'userState' => 'required', 'userId' => 'required|alphanum');
$validator = Validator::make($postData, $rules);
if ($validator->fails()) {
return Redirect::to('admin/profile')->withInput()->withErrors($validator);
} else {
if (Input::has('userKey')) {
$rulespass = array('userKey' => 'required|min:6|alphanum', 'cpass' => 'required|min:6|same:userKey');
$validator1 = Validator::make($postData, $rulespass);
if ($validator1->fails()) {
return Redirect::to('admin/profile')->withInput()->withErrors($validator1);
} else {
$input = json_encode(Input::except('_token', 'cpass'));
$update = Sample::update($input);
//print_r($update);exit;
if ($update && $update->status == "success") {
return Redirect::to('admin/profile')->with('success', $update->message);
} else {
return Redirect::to('admin/profile')->with('failure', "something went wrong");
}
}
} else {
$input = json_encode(Input::except('_token', 'userKey', 'cpass'));
$update = Sample::update($input);
//print_r($update);exit;
if ($update && $update->status == "success") {
return Redirect::to('admin/profile')->with('success', $update->message);
} else {
return Redirect::to('admin/profile')->with('failure', "something went wrong");
}
}
}
}
示例2: postStore
public function postStore()
{
$postData = Input::all();
$rules = array('userName' => 'required|min:5', 'userEmail' => 'required|email', 'userMobile' => 'required|min:10|numeric', 'userAddress1' => 'required', 'userAddress2' => 'required', 'userPincode' => 'required|min:6|numeric', 'userCity' => 'required', 'userState' => 'required', 'userId' => 'required|alphanum', 'prodCode' => 'required');
$validator = Validator::make($postData, $rules);
if ($validator->fails()) {
return Redirect::to('admin/subretailer/show/' . Input::get('userIdPk'))->withInput()->withErrors($validator);
} else {
if (Input::has('userKey')) {
$rulespass = array('userKey' => 'required|min:6|alphanum', 'cpass' => 'required|min:6|same:userKey');
$validator1 = Validator::make($postData, $rulespass);
if ($validator1->fails()) {
return Redirect::to('admin/subretailer/show/' . Input::get('userIdPk'))->withInput()->withErrors($validator1);
} else {
$input = json_encode(Input::except('_token', 'cpass'));
$data = Input::get('prodCode');
//print_r($data);
foreach ($data as $prodcode) {
$products[] = array('prodCode' => $prodcode, 'prodStatus' => '1');
}
$prodCodes = array('products' => $products);
//print_r(json_encode($prodCodes));
//
$input = json_encode(Input::except('prodCode', 'check-all', 'cpass'));
$finaloutput = array_merge(Input::except('_token', 'prodCode', 'check-all', 'cpass'), $prodCodes);
$op1 = json_encode($finaloutput);
//echo $op1;
$update = Sample::update($op1);
//print_r($update);exit;
if ($update && $update->status == "success") {
return Redirect::to('admin/subretailer/manageview')->with('success', $update->message);
} else {
return Redirect::to('admin/subretailer/show/' . Input::get('userIdPk'))->with('failure', "something went wrong");
}
}
} else {
$input = json_encode(Input::except('_token', 'userKey', 'cpass'));
//print_r($input);
$data = Input::get('prodCode');
//print_r($data);
foreach ($data as $prodcode) {
$products[] = array('prodCode' => $prodcode, 'prodStatus' => '1');
}
$prodCodes = array('products' => $products);
//print_r(json_encode($prodCodes));
//
$input = json_encode(Input::except('prodCode', 'check-all', 'cpass'));
$finaloutput = array_merge(Input::except('_token', 'prodCode', 'userKey', 'check-all', 'cpass'), $prodCodes);
$op1 = json_encode($finaloutput);
//echo $op1;
$update = Sample::update($op1);
//print_r($update);exit;
if ($update && $update->status == "success") {
return Redirect::to('admin/subretailer/manageview')->with('success', $update->message);
} else {
return Redirect::to('admin/subretailer/show/' . Input::get('userIdPk'))->with('failure', "something went wrong");
}
}
}
}