本文整理汇总了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');
}
}