private function sendVouchersByEmail($customer, $vouchers) { for ($i = 0; $i < count($vouchers); $i++) { $suscription = Suscription::firstOrCreate(array('customer_id' => $customer->id, 'voucher_id' => $vouchers[$i])); Mail::send('emails.auth.subscription', array('email' => Input::get('email'), 'voucher' => Voucher::find($vouchers[$i])), function ($message) { $message->to(Input::get('email'), ' ')->subject('Gracias por suscribirte! Aquí tienes tu código promocional.'); }); } }
public function update($id) { $voucher = Voucher::find($id); $voucher->project_id = Auth::user()->curr_project_id; $voucher->name = Input::get('name'); $voucher->description = Input::get('description'); $voucher->discount = Input::get('discount'); $voucher->nominal = Input::get('nominal'); $voucher->last_valid = Input::get('last_valid'); $voucher->save(); Session::flash('message', 'Sukses mengupdate voucher'); }
/** * Show the form for editing the specified voucher. * * @param int $id * @return Response */ public function edit($id) { $voucher = Voucher::find($id); return View::make('vouchers.edit', compact('voucher')); }
Route::group(array('before' => 'auth|admin'), function () { Route::get('admin/panel', function () { return View::make('admin.admin'); }); Route::get('admin/voucher/new', 'AdminController@newVoucherView'); Route::get('admin/voucher/edit/{voucher}', 'AdminController@editVoucherView'); Route::post('admin/voucher_process', 'AdminController@create'); Route::put('admin/voucher_process/{voucher}', 'AdminController@edit'); // Route::get('admin/vouchers', 'AdminController@showVouchersPage'); Route::get('admin/delete/{voucher}', 'AdminController@delteConfirmation'); // Route::get('admin/firstPreview/{voucher}', 'AdminController@firstPreview'); Route::delete('admin/voucher_process/{voucher}', 'AdminController@delete'); Route::get('admin/reminder/{voucher}', 'AdminController@sendRemainders'); Route::post('admin/update_note', function () { $id = intval($_GET['id']); $voucher = Voucher::find($id); $voucher->note = trim($_GET['value']); $voucher->save(); }); Route::get('admin/settings/', function () { return View::make('admin/settings'); }); //gestion usuarios Route::get('admin/users/', 'AdminController@users'); Route::post('admin/user_process', 'AdminController@new_user'); Route::put('admin/user_process/{user}', 'AdminController@edit_user'); Route::delete('admin/user_process/{user}', 'AdminController@deleteUser'); Route::get('admin/user/create', function () { $user = new User(); return View::make('admin.user_form')->with('user', $user)->with('method', 'post'); });
public function reductionsFilter($types, $id) { $reductable_type = $types; $reduction_id = $id; $reductions = Reduction::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('reductable_type', '=', $reductable_type)->where('reductable_id', '=', $reduction_id)->get(); switch ($reductable_type) { case 'Promotion': $discounts = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get(); $discount = Promotion::find($reduction_id); break; case 'Voucher': $discounts = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get(); $discount = Voucher::find($reduction_id); break; case 'Discount': $discounts = Discount::all(); $discount = Discount::find($reduction_id); break; case 'Charge': $discounts = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get(); $discount = Charge::find($reduction_id); break; default: $discounts = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get(); $discount = Promtion::find($reduction_id); break; } $menu = 'report'; return View::make('reports.reductions', compact('reductable_type', 'reduction_id', 'reductions', 'discounts', 'discount', 'menu')); }