本文整理汇总了PHP中Classes::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Classes::save方法的具体用法?PHP Classes::save怎么用?PHP Classes::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes
的用法示例。
在下文中一共展示了Classes::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postAddClasses
public function postAddClasses()
{
$validator = Validator::make(Input::all(), array('class_name' => 'required|max:30|min:3', 'stream_id' => 'required'));
if ($validator->fails()) {
$response = array('status' => 'failed', 'msg' => 'Item is not updated', 'errors' => $validator->failed(), 'error_messages' => $validator->messages());
return Response::json($response);
} else {
$new_class = Input::get('class_name');
$class_id = Input::get('class_id');
$streams_id = Input::get('stream_id');
$streams_name = Streams::find($streams_id)->stream_name;
if ($class_id) {
$classes = Classes::find($class_id);
$classes->class = $new_class;
$classes->streams_id = $streams_id;
$classes->school_id = $this->getSchoolId();
if ($classes->save()) {
$response = array('status' => 'success', 'msg' => 'Setting created successfully', 'errors' => null, 'data_send' => array('id' => $classes->id, 'class_name' => $classes->class, 'streams_id' => $classes->streams_id, 'streams_name' => $streams_name));
return Response::json($response);
}
} else {
$classes = new Classes();
$classes->class = $new_class;
$classes->streams_id = $streams_id;
$classes->school_id = $this->getSchoolId();
if ($classes->save()) {
$response = array('status' => 'success', 'msg' => 'Setting created successfully', 'errors' => null, 'data_send' => array('id' => $classes->id, 'class_name' => $classes->class, 'streams_id' => $classes->streams_id, 'streams_name' => $streams_name));
return Response::json($response);
}
}
}
$response = array('status' => 'failed', 'msg' => 'Item is not updated');
return Response::json($response);
}
示例2: addAction
public function addAction()
{
try {
$school = Input::get('hiddenSchools');
$name = Input::get('name');
$description = Input::get('description');
$publish = Input::get('publish');
$class = new Classes();
$class->name = $name;
$class->description = $description;
$class->published = $publish;
$class->save();
$id = DB::getPdo()->lastInsertId();
$schools = explode(',', $school);
for ($i = 0; $i < count($schools); $i++) {
if ($schools[$i] != "") {
$schoolclass = new Schoolclass();
$schoolclass->school = $schools[$i];
$schoolclass->class = $id;
$schoolclass->save();
}
}
//Session::put('id', $id);
Session::flash('status_success', 'Successfully Updated.');
return Redirect::route('admin/classEdit', array('id' => $id));
//return Redirect::route('admin/classEdit');
} catch (Exception $ex) {
echo $ex;
Session::flash('status_error', '');
}
}
开发者ID:AxelPardemann,项目名称:E-Learning-System-based-on-Laravel-and-Bootstrap,代码行数:31,代码来源:ClassController.php
示例3: addClasses
static function addClasses($inputs)
{
if (self::ifClassExists($inputs['classId'], $inputs['franchiseeCourse'])) {
return "exists";
} else {
$Class = new Classes();
$Class->class_name = $inputs['className'];
$Class->course_id = $inputs['franchiseeCourse'];
$Class->class_master_id = $inputs['classId'];
$Class->franchisee_id = Session::get('franchiseId');
$Class->created_by = Session::get('userId');
$Class->created_at = date("Y-m-d H:i:s");
$Class->save();
return $Class;
}
}
示例4: save_product
/**
* Save a product in the database (Create if need be)
*
* @param string $passkey
* @param int $intRowid
* @param string $strCode
* @param string $strName
* @param string $blbImage
* @param string $strClassName
* @param int $blnCurrent
* @param string $strDescription
* @param string $strDescriptionShort
* @param string $strFamily
* @param int $blnGiftCard
* @param int $blnInventoried
* @param double $fltInventory
* @param double $fltInventoryTotal
* @param int $blnMasterModel
* @param int $intMasterId
* @param string $strProductColor
* @param string $strProductSize
* @param double $fltProductHeight
* @param double $fltProductLength
* @param double $fltProductWidth
* @param double $fltProductWeight
* @param int $intTaxStatusId
* @param double $fltSell
* @param double $fltSellTaxInclusive
* @param double $fltSellWeb
* @param string $strUpc
* @param int $blnOnWeb
* @param string $strWebKeyword1
* @param string $strWebKeyword2
* @param string $strWebKeyword3
* @param int $blnFeatured
* @param string $strCategoryPath
* @return string
*/
public function save_product($passkey, $intRowid, $strCode, $strName, $blbImage, $strClassName, $blnCurrent, $strDescription, $strDescriptionShort, $strFamily, $blnGiftCard, $blnInventoried, $fltInventory, $fltInventoryTotal, $blnMasterModel, $intMasterId, $strProductColor, $strProductSize, $fltProductHeight, $fltProductLength, $fltProductWidth, $fltProductWeight, $intTaxStatusId, $fltSell, $fltSellTaxInclusive, $fltSellWeb, $strUpc, $blnOnWeb, $strWebKeyword1, $strWebKeyword2, $strWebKeyword3, $blnFeatured, $strCategoryPath)
{
if (!$this->check_passkey($passkey)) {
return self::FAIL_AUTH;
}
// We must preservice the Rowid of Products within the Web Store
// database and must therefore see if it already exists
$objProduct = Product::model()->findByPk($intRowid);
if (!$objProduct) {
$objProduct = new Product();
$objProduct->id = $intRowid;
}
$strName = trim($strName);
$strName = trim($strName, '-');
$strName = substr($strName, 0, 255);
$strCode = trim($strCode);
$strCode = str_replace('"', '', $strCode);
$strCode = str_replace("'", '', $strCode);
if (empty($strName)) {
$strName = 'missing-name';
}
if (empty($strDescription)) {
$strDescription = '';
}
$objProduct->code = $strCode;
$objProduct->title = $strName;
//$objProduct->class_name = $strClassName;
$objProduct->current = $blnCurrent;
$objProduct->description_long = $strDescription;
$objProduct->description_short = $strDescriptionShort;
//$objProduct->family = $strFamily;
$objProduct->gift_card = $blnGiftCard;
$objProduct->inventoried = $blnInventoried;
$objProduct->inventory = $fltInventory;
$objProduct->inventory_total = $fltInventoryTotal;
$objProduct->master_model = $blnMasterModel;
if ($intMasterId > 0) {
$objProduct->parent = $intMasterId;
} else {
$objProduct->parent = null;
}
$objProduct->product_color = $strProductColor;
$objProduct->product_size = $strProductSize;
$objProduct->product_height = $fltProductHeight;
$objProduct->product_length = $fltProductLength;
$objProduct->product_width = $fltProductWidth;
$objProduct->product_weight = $fltProductWeight;
$objProduct->tax_status_id = $intTaxStatusId;
$objProduct->sell = $fltSell;
$objProduct->sell_tax_inclusive = $fltSellTaxInclusive;
//If we're in TaxIn Mode, then SellWeb has tax and we reverse it.
if (_xls_get_conf('TAX_INCLUSIVE_PRICING', 0) == 1) {
if ($fltSellWeb != 0) {
//Tax in with a sell on web price
$objProduct->sell_web_tax_inclusive = $fltSellWeb;
//LS sends tax in web already
$objProduct->sell_web = Tax::StripTaxesFromPrice($fltSellWeb, $intTaxStatusId);
} else {
//We use our regular prices and copy them price
$objProduct->sell_web_tax_inclusive = $fltSellTaxInclusive;
$objProduct->sell_web = $fltSell;
}
//.........这里部分代码省略.........