本文整理汇总了PHP中Coupon::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Coupon::find方法的具体用法?PHP Coupon::find怎么用?PHP Coupon::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coupon
的用法示例。
在下文中一共展示了Coupon::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateListCoupon
public function UpdateListCoupon()
{
$input = Input::all();
$listCouponID = $input['update_list_coupon_id'];
$listCouponID = explode(",", $listCouponID);
foreach ($listCouponID as $p) {
$coupon = Coupon::find($p);
$coupon->code = $input['code'];
$coupon->description = $input['description'];
$coupon->from_date = $input['from_date'];
$coupon->to_date = $input['to_date'];
$coupon->save();
}
}
示例2: delete_coupon
public function delete_coupon()
{
$id = Request::segment(4);
$coupon = Coupon::find($id);
Coupon::where('id', $id)->delete();
$message = "Successfully deleted the coupon";
$type = "success";
return Redirect::to('/admin/coupons')->with('type', $type)->with('message', $message);
}
示例3: postEdit
public function postEdit()
{
$batch = Input::get('batch') ? 1 : 0;
if ($batch) {
$get_all = Coupon::where('batchuniqid', '=', Input::get('batchuniqid'))->get();
foreach ($get_all as $key => $value) {
$coup = Coupon::find($value->id);
$coup->batchuniqid = Input::get('batchuniqid');
$coup->discount = Input::get('Discount');
$coup->type = Input::get('Type');
$coup->parent_id = Input::get('Parent_Id');
$coup->min_val = Input::get('min_val');
$coup->expiry = Input::get('Expiry');
$coup->save();
}
Session::flash('message', 'All coupons has been updated sccessfully.');
return Redirect::to('coupons/viewall');
} else {
$coup = Coupon::find(Input::get('id'));
$coup->batchuniqid = Input::get('batchuniqid');
$coup->code = Input::get('batchuniqid');
$coup->discount = Input::get('Discount');
$coup->type = Input::get('Type');
$coup->parent_id = Input::get('Parent_Id');
$coup->expiry = Input::get('Expiry');
$coup->status = Input::get('Status');
$coup->min_val = Input::get('min_val');
$coup->save();
Session::flash('message', 'Coupon has been updated sccessfully.');
return Redirect::to('coupons/viewall');
}
Session::flash('message', 'Coupon update failed.');
return Redirect::to('coupons/viewall');
}