public function update($id) { $ip = Ip::findOrFail($id); $ip->fill(Input::all()); $ip->save(); return Redirect::action('IpController@index'); }
public function cargoTarjeta() { $openpay = Openpay::getInstance('m7bm553khn5nbyn5fg75', 'sk_80f1cd0745f24af8ae46929496601fa5'); // Variable de identificación. $cliente = array('name' => Input::get('nombre'), 'last_name' => Input::get('apellido'), 'phone' => Input::get('telefono') ?: null, 'email' => Input::get('email')); $chargeData = array('method' => 'card', 'source_id' => Input::get('token_id'), 'amount' => (double) Input::get('monto'), 'description' => 'Pago póliza seguro', 'device_session_id' => Input::get('deviceIdHiddenFieldName'), 'customer' => $cliente); try { $formato = Input::get('formato'); switch ($formato) { case 'Mensual': $plazo = 1; break; case 'Trimestral': $plazo = 3; break; case 'Semestral': $plazo = 6; break; } $charge = $openpay->charges->create($chargeData); if (Input::get('plan')) { $customer = $openpay->customers->add($cliente); $cardData = array('token_id' => Input::get('token_id')); $card = $customer->cards->add($cardData); $data = array('id_cliente' => $customer, 'id_tarjeta' => $card, 'device_session_id' => Input::get('deviceIdHiddenFieldName'), 'monto' => Input::get('recibos'), 'proximo_pago' => date('Y-m-d', strtotime('+' . $plazo . ' month', strtotime(date('Y-m-d')))), 'pagos_restantes' => 12 - $plazo); DB::table('planes')->insert($data); } } catch (Exception $e) { $mensaje = "Hubo un error con la tarjeta, no se pudo hacer el cargo. <br> Revísa tu tarjeta e intenta de nuevo, si el problema persiste contáctanos. "; return Redirect::action('QuoteController@procesarPago', array('opcion' => Input::get('opcion'), 'id' => Input::get('id'), 'monto' => Input::get('monto'), 'plan' => Input::get('plan'), 'recibos' => Input::get('recibos'), 'formato' => Input::get('formato'), 'nombre' => Input::get('primer_nombre'), 'apellido' => Input::get('apellido_paterno'), 'telefono' => Input::get('particular_numero'), 'email' => Input::get('email'), 'error' => true)); } $mensaje = 'Cargo ejecutado con exito, revise su bandeja'; return Redirect::to('/')->with('message', $mensaje); }
public function open() { if (!\Auth::check()) { return view('start'); } return \Redirect::action('HomeController@dashboard'); }
public function handleDelete() { $id = Input::get('flickr_pic'); $pic = Flickr_pic::findOrFail($id); $pic->delete(); return Redirect::action('FlickrPicController@showFavs'); }
public function showWelcome() { if (Auth::check()) { return Redirect::action('ProfileController@getProfile', array('username' => Auth::user()->username)); } $this->layout->content = View::make('home.home'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $espera = Espera::where('id', $id)->firstOrFail(); $dt = new DateTime(); $espera->update(array('admitido' => 0, 'end_date' => $dt->format('y-m-d H:i:s'))); return Redirect::action('Historial_clinicoController@index')->with('message', 'Paciente eliminado de la lista de espera.'); }
public function finalizarchamado() { $intchamadoid = $_GET['id']; $dtaencerramento = date('Y-m-d H:i:s'); DB::table('tblchamados')->where('intchamadoid', '=', "{$intchamadoid}")->update(array('dtaencerramento' => "{$dtaencerramento}")); return Redirect::action('chamadosoiController@controlechamado'); }
public function postEdit($id) { if (!$this->checkRoute()) { return Redirect::route('index'); } $title = 'Edit A Modpack Code - ' . $this->site_name; $input = Input::only('name', 'deck', 'description', 'slug'); $modpacktag = ModpackTag::find($id); $messages = ['unique' => 'This modpack tag already exists in the database!']; $validator = Validator::make($input, ['name' => 'required|unique:modpack_tags,name,' . $modpacktag->id, 'deck' => 'required'], $messages); if ($validator->fails()) { return Redirect::action('ModpackTagController@getEdit', [$id])->withErrors($validator)->withInput(); } $modpacktag->name = $input['name']; $modpacktag->deck = $input['deck']; $modpacktag->description = $input['description']; $modpacktag->last_ip = Request::getClientIp(); if ($input['slug'] == '' || $input['slug'] == $modpacktag->slug) { $slug = Str::slug($input['name']); } else { $slug = $input['slug']; } $modpacktag->slug = $slug; $success = $modpacktag->save(); if ($success) { Cache::tags('modpacks')->flush(); Queue::push('BuildCache'); return View::make('tags.modpacks.edit', ['title' => $title, 'success' => true, 'modpacktag' => $modpacktag]); } return Redirect::action('ModpackTagController@getEdit', [$id])->withErrors(['message' => 'Unable to edit modpack code.'])->withInput(); }
public function deposit() { //retrieve POST value $param = Input::only('credits', 'account_id'); $rules = array('credits' => 'required|numeric|min:1,max:1000000', 'account_id' => 'exists:acl_users,id'); $messages = array('buyer_id.exists' => 'Buyer id is not valid.', 'merchant_id.exists' => 'Merchant id is not valid'); $validator = Validator::make($param, $rules, $messages); if ($validator->passes()) { $retrieve = Wallet::where('account_id', $param['account_id'])->first(); $credits = array('account_id' => $param['account_id'], 'credits' => $param['credits']); if (!empty($retrieve)) { try { $update = $retrieve->increment('credits', $param['credits']); if ($update == 1) { $fundin = array('wallet_id' => $retrieve->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['credits'], 'description' => 'Deposit credits', 'fundtype' => 'fundin'); $funds = Fundinout::create($fundin); } } catch (Exception $e) { return false; } } else { $add_credits = Wallet::create($credits); $fundin = array('wallet_id' => $add_credits->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['credits'], 'description' => 'Deposit credits', 'fundtype' => 'fundin'); $funds = Fundinout::create($fundin); } $message = 'Credit has been successfully added.'; return Redirect::action('roulette.index')->with('success', $message); } else { $messages = $validator->messages(); return Redirect::action('roulette.index')->with('error', $messages->all()); } }
public function create() { $data = Input::all(); $promo = new Promo(); $promo->days = Input::get('days'); $promo->code = Crypt::encrypt(Input::get('code')); $promo->status = 0; $promo->colony_id = Input::get('colony_id'); if ($promo->save()) { $user_id = Input::get('admin_colonia'); $admin_user = DB::connection('habitaria_dev')->select('select email from users where id = ? ', [$user_id]); foreach ($admin_user as $user) { $admin_email = $user->email; } $admin_neighbor = Neighbors::where('user_id', '=', $user_id)->first(); $colony_data = Colony::where('id', '=', $promo->colony_id)->first(); $colony_name = $colony_data->name; $data = array('email' => $admin_email, 'days' => $promo->days, 'code' => Crypt::decrypt($promo->code), 'colony' => $colony_name, 'admin' => $admin_neighbor->name . ' ' . $admin_neighbor->last_name); Mail::send('emails.cupon_promo', $data, function ($message) use($admin_email) { $message->subject('Promo de HABITARIA'); $message->to($admin_email); }); $notice_msg = 'Promo enviada al administrador de la Colonia: ' . $colony_name; return Redirect::action('PromoController@report_promo', $promo->colony_id)->with('error', false)->with('msg', $notice_msg)->with('class', 'info'); } }
public function getView($characterID) { $character = DB::table('account_apikeyinfo_characters')->leftJoin('account_apikeyinfo', 'account_apikeyinfo_characters.keyID', '=', 'account_apikeyinfo.keyID')->leftJoin('seat_keys', 'account_apikeyinfo_characters.keyID', '=', 'seat_keys.keyID')->join('account_accountstatus', 'account_apikeyinfo_characters.keyID', '=', 'account_accountstatus.keyID')->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')->leftJoin('invTypes', 'character_skillintraining.trainingTypeID', '=', 'invTypes.typeID')->where('character_charactersheet.characterID', $characterID)->first(); // Check if whave knowledge of this character, else, simply redirect to the // public character function if (count($character) <= 0) { return Redirect::action('CharacterController@getPublic', array('characterID' => $characterID))->withErrors('No API key information is available for this character. This is the public view of the character. Submit a API key with this character on for more information.'); } // Next, check if the current user has access. Superusers may see all the things, // normal users may only see their own stuffs. SuperUser() inherits 'recruiter' if (!\Auth::hasAccess('recruiter')) { if (!in_array(EveAccountAPIKeyInfoCharacters::where('characterID', $characterID)->pluck('keyID'), Session::get('valid_keys'))) { return Redirect::action('CharacterController@getPublic', array('characterID' => $characterID))->withErrors('You do not have access to view this character. This is the public view of the character.'); } } // Determine the other characters that are on this API key $other_characters = DB::table('account_apikeyinfo_characters')->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')->where('account_apikeyinfo_characters.keyID', $character->keyID)->where('account_apikeyinfo_characters.characterID', '<>', $character->characterID)->get(); // Get the other characters linked to this key as a person if any $key = $character->keyID; // Small var declaration as I doubt you can use $character->keyID in the closure $people = DB::table('seat_people')->leftJoin('account_apikeyinfo_characters', 'seat_people.keyID', '=', 'account_apikeyinfo_characters.keyID')->whereIn('personID', function ($query) use($key) { $query->select('personID')->from('seat_people')->where('keyID', $key); })->groupBy('characterID')->get(); // Finally, give all this to the view to handle return View::make('character.view')->with('character', $character)->with('other_characters', $other_characters)->with('people', $people); }
public function destroy($id) { $articulo = Articulo::findOrFail($id); $req_id = $articulo->req->id; $articulo->delete(); return Redirect::action('RequisicionController@show', array($req_id)); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, Request $request) { $tipoProyecto = TipoProyecto::findOrFail($id); $tipoProyecto->tipo_proyecto = $request->input('tipo_proyecto'); $tipoProyecto->save(); return Redirect::action('TiposProyectosController@index'); }
function getFinalize($method = 'shopify', $url = '') { $id = \Session::get('integration_id', 0); $job = (new GetStoreAuthToken($method, $url, $id))->onQueue('store_auth'); $this->dispatch($job); return \Redirect::action('Apricot\\StoreController@show', ['id' => $id]); }
/** * Store a newly created post in storage. * * @return Response */ public function store() { $validate = Validator::make(Input::all(), Question::$rules); if ($validate->passes()) { //save a new Question $question = new Question(); $question->title = Input::get('title'); $question->body = Input::get('body'); $question->user_id = Auth::id(); $question->save(); $question_id = $question->id; //saving Tags in Tag Table /* convert input to array */ $tags_arr = explode(',', Input::get('tag')); /* save in Tag table and return object for saving in Tagmap table */ foreach ($tags_arr as $tag_str) { $tag_obj = Tag::firstOrCreate(array('title' => $tag_str)); //this line will attach a tag ( insert and save automatically ) $new_question->tags()->attach($tag_obj->id); } return Redirect::action('QuestionController@index'); } return Redirect::back()->withErrors($validate)->withInput(); }
public function handleDelete() { $id = Input::get('id'); $offer = $this->offer->findOrFail($id); $offer->delete(); return Redirect::action('OffersController@index'); }
public function postGamertagOwnership(OwnershipFormRequest $request) { $account = Account::where('seo', Text::seoGamertag($request->request->get('gamertag')))->first(); $this->user->account_id = $account->id; $this->user->save(); return \Redirect::action('UserCpController@getIndex')->with('flash_message', ['header' => 'Gamertag Verified!', 'close' => true, 'body' => 'You have proved ownership of <strong>' . $account->gamertag . '</strong>.']); }
/** * @return string * User Registration. */ public function postRegister() { $input = Input::only('firstname', 'lastname', 'email', 'password', 'confirm_password'); try { $rules = array('firstname' => 'required|min:2', 'lastname' => 'required|min:2', 'email' => 'required|email|unique:users', 'password' => 'required|min:4', 'confirm_password' => 'required|same:password'); $messages = array('required' => 'Het :attribute veld is verplicht in te vullen.', 'min' => 'Het :attribute veld moet minstens 2 karakters bevatten.'); $validator = Validator::make($input, $rules, $messages); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator); } else { unset($input['confirm_password']); $user = Sentry::register($input); $activationCode = $user->getActivationCode(); $data = array('token' => $activationCode); Mail::send('emails.auth.welcome', $data, function ($message) use($user) { $message->from('*****@*****.**', 'Site Admin'); $message->to($user['email'], $user['first_name'], $user['last_name'])->subject('Welcome to My Laravel app!'); }); if (count(Mail::failures()) > 0) { $errors = 'Failed to send password reset email, please try again.'; } if ($user) { return Redirect::action('AuthController@login'); } } } catch (Sentry\SentryException $e) { // Create custom error msgs. } }
public function getPush() { list($script, $host) = Session::get('action_data'); if (!$script) { return Redirect::action('GameserverController@index')->with("Really nope"); } $commands = $script->commands; // dd($commands); if (!($commands != "")) { return Redirect::action('GameserverController@index')->with("Nope"); } if ($host == "") { return Redirect::action('GameserverController@index')->with("wat"); } $req = new \Jyggen\Curl\Request('http://' . $host); $req->setOption(CURLOPT_CONNECTTIMEOUT, 1); $req->setOption(CURLOPT_TIMEOUT, 1); $req->setOption(CURLOPT_FOLLOWLOCATION, true); $req->setOption(CURLOPT_POST, true); $req->setOption(CURLOPT_POSTFIELDS, 'commandline=' . urlencode($commands)); $req->execute(); if ($req->isSuccessful()) { // return $req->getRawResponse(); return Redirect::action('GameserverController@index'); } else { // throw new \Jyggen\Curl\Exception\CurlErrorException($req->getErrorMessage()); return Redirect::action('GameserverController@index')->with($req->getErrorMessage()); } }
public function getIndex() { return Redirect::action('ForumThreadsController@getIndex'); $articles = $this->articles->getFeaturedArticles(3); $threads = $this->comments->getFeaturedForumThreads(3); $this->view('home.index', compact('articles', 'threads')); }
public function crearSalida() { //Recuperar información //Crear Salida $salida = new Salida(); $salida->entrada_id = Input::get('entrada_id'); $salida->fecha_salida = date("Y-m-d"); $salida->urg_id = Input::get('urg_id'); $salida->cmt = Input::get('cmt'); $salida->usr_id = ''; $salida->save(); //Insertar artículos @entradas_articulos /* * @todo Validar cantidades -> Que pasa si no son validas? * Validar Sum(Cantidad Entrada) - Sum(Cantidad Salida) > 0 */ $articulos = Input::get('articulos'); foreach ($articulos as $articulo_id) { $salida_articulo = new SalidaArticulo(); $salida_articulo->salida()->associate($salida); $salida_articulo->articulo_id = $articulo_id; $salida_articulo->cantidad = Input::get('cantidad_' . $articulo_id); $salida_articulo->save(); } //Mostrar información de salida (Redirect) return Redirect::action('SalidaController@info', array('id' => $salida->id)); }
public function postDelete($threadId) { $thread = $this->threads->requireById($threadId); $command = new Commands\DeleteThreadCommand($thread, Auth::user()); $thread = $this->bus->execute($command); return Redirect::action('ForumController@getListThreads'); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { $event = IDSLog::find($id)->first(); Event::fire('admin.intrusion.destroy', array($event)); $event->delete(); return \Redirect::action('Admin\\Security\\IntrusionController@index'); }
/** * Add new people * * @param Request $request * @return array */ public function processingRequest(Request $request) { //@todo add request form when will be complex logic $this->validate($request, ['name' => 'required|string', 'surname' => 'required|string', 'age' => 'required|integer', 'gender' => 'required|in:male,female', 'spouse' => 'exists:peoples,id', 'parent_id' => 'exists:peoples,id']); $this->peopleManager->addPeople($request->all()); return \Redirect::action('PeopleController@showPeopleForm')->with('messageSuccess', 'The people successfully added'); }
public function postEdit($id) { if (!$this->checkRoute()) { return Redirect::route('index'); } $title = 'Edit A Modpack Creator - ' . $this->site_name; $creator = Creator::find($id); $input = Input::only('name', 'deck', 'website', 'donate_link', 'bio', 'slug'); $messages = ['unique' => 'The modpack creator already exists in the database.', 'url' => 'The :attribute field is not a valid URL.']; $validator = Validator::make($input, ['name' => 'required|unique:creators,name,' . $creator->id, 'website' => 'url', 'donate_link' => 'url'], $messages); if ($validator->fails()) { return Redirect::action('CreatorController@getAdd')->withErrors($validator)->withInput(); } $creator->name = $input['name']; $creator->deck = $input['deck']; $creator->website = $input['website']; $creator->donate_link = $input['donate_link']; $creator->bio = $input['bio']; if ($input['slug'] == '' || $input['slug'] == $creator->slug) { $slug = Str::slug($input['name']); } else { $slug = $input['slug']; } $creator->slug = $slug; $creator->last_ip = Request::getClientIp(); $success = $creator->save(); if ($success) { return View::make('creators.edit', ['title' => $title, 'creator' => $creator, 'success' => true]); } return Redirect::action('CreatorController@getEdit', [$id])->withErrors(['message' => 'Unable to edit modpack creator.'])->withInput(); }
/** * Store a newly created resource in storage. * POST /group * * @return Response */ public function store($id) { //create sub team //return Redirect::action('SubController@create',$id)->with( 'notice', 'This action cannot be perform at this moment, please comeback soon.'); $user = Auth::user(); $club = $user->clubs()->FirstOrFail(); $parent_team = Team::find($id); $uuid = Uuid::generate(); $validator = Validator::make(Input::all(), Team::$rules_group); if ($validator->passes()) { $team = new Team(); $team->id = $uuid; $team->name = Input::get('name'); $team->season_id = $parent_team->season_id; $team->program_id = $parent_team->program_id; $team->description = $parent_team->description; $team->early_due = $parent_team->getOriginal('early_due'); $team->early_due_deadline = $parent_team->early_due_deadline; $team->due = $parent_team->getOriginal('due'); $team->plan_id = $parent_team->plan_id; $team->open = $parent_team->open; $team->close = $parent_team->close; $team->max = Input::get('max'); $team->status = $parent_team->getOriginal('status'); $team->parent_id = $parent_team->id; $team->club_id = $club->id; $team->allow_plan = 1; $status = $team->save(); if ($status) { return Redirect::action('TeamController@show', $parent_team->id)->with('messages', 'Group created successfully'); } } $error = $validator->errors()->all(':message'); return Redirect::action('SubController@create', $id)->withErrors($validator)->withInput(); }
public function actualizar($id, Request $request) { try { $rules = array('nombre' => array('required', 'string', 'min:5', 'unique:promociones,nombre' . $id), 'descripcion' => array('required', 'string', 'min:30'), 'imagen' => array('image', 'image_size:>=300,>=300'), 'inicio' => array('date'), 'fin' => array('date', 'after: inicio')); $this->validate($request, $rules); $registro = Promociones::find($id); $registro->nombre = \Input::get('nombre'); $registro->descripcion = \Input::get('descripcion'); if ($archivo = BRequest::file('foto')) { $foto = BRequest::file('imagen'); $extension = $foto->getClientOriginalExtension(); Storage::disk('image')->put($foto->getFilename() . '.' . $extension, File::get($foto)); $registro->imagen = $foto->getFilename() . '.' . $extension; } if ($inicio = \Input::get('inicio')) { $registro->inicio = \Input::get('inicio'); } if ($inicio = \Input::get('fin')) { $registro->fin = \Input::get('fin'); } $registro->save(); return \Redirect::route('adminPromociones')->with('alerta', 'La promocion ha sido modificada con exito!'); } catch (ValidationException $e) { return \Redirect::action('PromocionesCtrl@editar', array('id' => $id))->withInput()->withErrors($e->get_errors()); } }
public function procesaNuevo() { $viatico = new Viatico(); $viatico->mec_origen = Input::get('mec_origen'); $viatico->inst_genera = Input::get('inst_genera'); $viatico->ur = Input::get('ur'); $viatico->tipo_rep = Input::get('tipo_rep'); $viatico->consecutivo = Input::get('consecutivo'); $viatico->nombre = Input::get('nombre'); $viatico->cargo = Input::get('cargo'); $viatico->grupo = Input::get('grupo'); $viatico->tipo_viaje = Input::get('tipo_viaje'); $viatico->acuerdo = Input::get('acuerdo'); $viatico->oficio = Input::get('oficio'); $viatico->fechainicio_com = Input::get('fechainicio_com'); $viatico->fechafin_com = Input::get('fechafin_com'); $viatico->observaciones = Input::get('observaciones'); $viatico->gasto_alimentacion = Input::get('gasto_alimentacion'); $viatico->gasto_viatico = Input::get('gasto_viatico'); $viatico->comprobado = Input::get('comprobado'); $viatico->sin_comprobar = Input::get('sin_comprobar'); $viatico->viatico_devuelto = Input::get('viatico_devuelto'); $viatico->save(); return Redirect::action('ViaticosController@consultar', array('vid' => $viatico->id)); }
public function join() { $data = Input::only(['name', 'room_id']); print_r($data); $room = Room::find($data['room_id']); if (!$room) { return Redirect::action('PrepareController@room'); } if ($room->state !== 'open') { throw new BadRequestHttpException('既にゲームは開始しています。'); } if ($room->mates->count() >= $room->member_number) { throw new BadRequestHttpException('全ユーザーが揃っています'); } if (!isset($data['name']) || $data['name'] == '') { //名前指定していない場合 return Redirect::action('PrepareController@rooms'); } $i = 0; do { $hash = sha1(date("Y/m/d H:i:s.u") . 'zCeZu12X' . $data['name'] . $data['room_id']); $hashed_mate = Mate::where('hash', $hash)->select('hash')->first(); $i++; if ($i > 50) { throw new InternalErrorException('ユーザー作成に失敗しました hash衝突しまくり'); } } while ($hashed_mate && $i < 100); $mate = Mate::create(['name' => $data['name'], 'last_state' => 'open', 'hash' => $hash, 'cast_id' => 0, 'room_id' => $data['room_id'], 'select_user_id' => '', 'is_alive' => 1]); if (!$mate) { throw new InternalErrorException('ユーザー作成に失敗しました'); } $room->touch(); return Redirect::action('PlayController@index', ['hash' => $hash]); }
public function crearEntrada() { //Recupera información de OC $oc = Oc::where('oc', '=', Input::get('oc'))->get(); //Crear Entrada $entrada = new Entrada(); $entrada->fecha_entrada = date("Y-m-d"); $entrada->ref = $oc[0]->oc; $entrada->ref_tipo = 'OC'; $entrada->ref_fecha = $oc[0]->fecha_oc; $entrada->urg_id = Input::get('urg_id'); $entrada->proveedor_id = $oc[0]->proveedor_id; $entrada->cmt = Input::get('cmt'); $entrada->usr_id = ''; $entrada->save(); //Insertar artículos @entradas_articulos $arr_art_count = Input::get('art_count'); foreach ($arr_art_count as $art_count) { $oc_articulo = OcArticulo::where('oc_id', '=', $oc[0]->id)->where('art_count', '=', $art_count)->get(); $entradas_articulos = new EntradaArticulo(); $entradas_articulos->entrada()->associate($entrada); $entradas_articulos->articulo_id = $oc_articulo[0]->articulo_id; $entradas_articulos->cantidad = $oc_articulo[0]->cantidad; $entradas_articulos->costo = $oc_articulo[0]->costo; $entradas_articulos->impuesto = $oc_articulo[0]->impuesto; $entradas_articulos->save(); } $oc[0]->estatus = 'Entrada Generada'; $oc[0]->save(); //Mostrar información de entrada (Redirect) return Redirect::action('EntradaController@info', array('id' => $entrada->id)); }