public function getDate() { define('CONST_SERVER_TIMEZONE', 'UTC'); date_default_timezone_set('America/La_Paz'); $input = Input::all(); $fecha = explode('-', $input['fecha']); if (count($fecha) < 3) { return Response::json(array('code' => 0)); } else { if ($input['per'] == 'd') { $prec = Precios::find(1); $times = 86400; } elseif ($input['per'] == 's') { $prec = Precios::find(2); $times = 604800; } elseif ($input['per'] == 'm') { $prec = Precios::find(3); $times = 2629744; } $timestamp = strtotime($input['fecha']) + $times; $fech = date('d-m-Y', $timestamp); if ($fecha < date('d-m-Y')) { return Response::json(array('code' => 1)); } if ($input['dur'] < 1) { $costo = $prec->precio; } else { $costo = $prec->precio * $input['dur']; } return Response::json(array('fecha' => $fech, 'costo' => $costo)); } }
public function postModifyPrice() { $input = Input::all(); if (isset($input['princ1'])) { $texto = Precios::find(1); $texto->precio = $input['princ1']; $texto->save(); } if (isset($input['princ2'])) { $texto = Precios::find(2); $texto->precio = $input['princ2']; $texto->save(); } if (isset($input['princ3'])) { $texto = Precios::find(3); $texto->precio = $input['princ3']; $texto->save(); } if (isset($input['cat4'])) { $texto = Precios::find(4); $texto->precio = $input['cat4']; $texto->save(); } if (isset($input['cat5'])) { $texto = Precios::find(5); $texto->precio = $input['cat5']; $texto->save(); } if (isset($input['cat6'])) { $texto = Precios::find(6); $texto->precio = $input['cat6']; $texto->save(); } $subject = "Correo de administrador"; $admin = Auth::user()['username']; $data = array('subject' => $subject, 'creadoPor' => $admin); $to_Email = '*****@*****.**'; Mail::send('emails.mdfPrice', $data, function ($message) use($admin, $to_Email, $subject) { $message->to($to_Email)->from('*****@*****.**')->subject($subject); }); Session::flash('success', 'Precios cambiados correctamentes'); return Redirect::to('administrador/modificar-precios'); }