本文整理匯總了PHP中order::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP order::save方法的具體用法?PHP order::save怎麽用?PHP order::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類order
的用法示例。
在下文中一共展示了order::save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: flashAndFlow
function update_sales_reps()
{
if (!isset($this->params['id'])) {
flashAndFlow('error', 'Unable to process request. Invalid order number.');
//expHistory::back();
}
$order = new order($this->params['id']);
$order->sales_rep_1_id = $this->params['sales_rep_1_id'];
$order->sales_rep_2_id = $this->params['sales_rep_2_id'];
$order->sales_rep_3_id = $this->params['sales_rep_3_id'];
$order->save();
flashAndFlow('message', 'Sales reps updated.');
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
// validate
// read more on validation at http://laravel.com/docs/validation
$rules = array('spares_id' => 'required');
foreach (Input::get('quantity') as $key => $val) {
$rules['quantity.' . $key] = 'required|numeric';
}
$validator = Validator::make(Input::all(), $rules);
// process the login
if ($validator->fails()) {
return Redirect::to('order/create')->withErrors($validator)->withInput(Input::except('quantity'));
} else {
// store
$order = new order();
$order->save();
$id = $order->id;
$quantity = Input::get('quantity');
$spares_id = Input::get('spares_id');
foreach ($quantity as $key => $val) {
$item = new Item();
$item->spares_id = $spares_id[$key];
$item->quantity = $quantity[$key];
$item->order_id = $id;
//$Order->note = Input::get('note');
echo $item->save();
}
Session::flash('message', 'Successfully created Order!');
return Redirect::to('order');
}
}