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.'); }); } }
Route::any('shop/{shop}', 'ShopController@shop'); Route::post('customer/edit_name', function () { $id = intval($_GET['id']); $customer = Customer::find($id); $customer->customer_name = $_GET['value']; $customer->save(); }); Route::post('suscription/edit_reuses', function () { $id = intval($_GET['id']); $suscription = Suscription::find($id); $suscription->reuses = intval($_GET['value']); $suscription->save(); }); Route::post('suscription/edit_uses/', function () { $id = intval($_GET['id']); $suscription = Suscription::find($id); $suscription->is_used = intval($_GET['value']); $suscription->save(); }); Route::get('orderBy', function () { $order = Session::get('orderBy') == 'asc' ? 'desc' : 'asc'; Session::put('orderBy', $order); return Redirect::back(); }); }); //admin Route::group(array('before' => 'auth|admin'), function () { Route::get('admin/panel', function () { return View::make('admin.admin'); }); Route::get('admin/voucher/new', 'AdminController@newVoucherView');