/** * Update the specified resource in storage. * * @param int $id * * @return Response */ public function update($id = null) { $user = Auth::user(); $input = Input::only('location', 'website', 'bio', 'twitter', 'facebook', 'github', 'cover', 'image', 'notify_articles'); $user->profile()->update($input); return Redirect::route('user-package::profile.show'); }
/** * Veritrans Credit Card * * 1. Check Order * 2. Save Payment * * @return Response */ public function veritranscc() { if (!Input::has('order_id')) { return new JSend('error', (array) Input::all(), 'Tidak ada data order id.'); } $errors = new MessageBag(); DB::beginTransaction(); //1. Validate Sale Parameter $order = Input::only('order_id', 'gross_amount', 'payment_type', 'masked_card', 'transaction_id'); //1a. Get original data $sale_data = \App\Models\Sale::findorfail($order['order_id']); //2. Save Payment $paid_data = new \App\Models\Payment(); $payment['transaction_id'] = $sale_data['id']; $payment['method'] = $order['payment_type']; $payment['destination'] = 'Veritrans'; $payment['account_name'] = $order['masked_card']; $payment['account_number'] = $order['transaction_id']; $payment['ondate'] = \Carbon\Carbon::parse($order['transaction_time'])->format('Y-m-d H:i:s'); $payment['amount'] = $order['gross_amount']; $paid_data = $paid_data->fill($payment); if (!$paid_data->save()) { $errors->add('Log', $paid_data->getError()); } if ($errors->count()) { DB::rollback(); return response()->json(new JSend('error', (array) Input::all(), $errors), 404); } DB::commit(); $final_sale = \App\Models\Sale::id($sale_data['id'])->with(['voucher', 'transactionlogs', 'user', 'transactiondetails', 'transactiondetails.varian', 'transactiondetails.varian.product', 'paidpointlogs', 'payment', 'shipment', 'shipment.address', 'shipment.courier', 'transactionextensions', 'transactionextensions.productextension'])->first()->toArray(); return response()->json(new JSend('success', (array) $final_sale), 200); }
/** * Tracker update application * * 1. Check input * 2. Check auth * 3. Set current absence * @return Response */ function updateversion() { $attributes = Input::only('application'); //1. Check input if (!$attributes['application']) { return Response::json('101', 200); } if (!isset($attributes['application']['api']['client']) || !isset($attributes['application']['api']['secret']) || !isset($attributes['application']['api']['tr_ver']) || !isset($attributes['application']['api']['station_id']) || !isset($attributes['application']['api']['email']) || !isset($attributes['application']['api']['password'])) { return Response::json('102', 200); } //2. Check auth $client = \App\Models\Api::client($attributes['application']['api']['client'])->secret($attributes['application']['api']['secret'])->workstationaddress($attributes['application']['api']['station_id'])->with(['branch'])->first(); if (!$client) { $filename = storage_path() . '/logs/appid.log'; $fh = fopen($filename, 'a+'); $template = date('Y-m-d H:i:s : Login : '******'application']['api']) . "\n"; fwrite($fh, $template); fclose($fh); return Response::json('402', 200); } //3. Set current absence if ((double) $attributes['application']['api']['tr_ver'] < (double) Config::get('current.absence.version')) { return Response::json('sukses|' . Config::get('current.absence.url1') . '|' . Config::get('current.absence.url2'), 200); } return Response::json('200', 200); }
/** * Display a listing of the available mosques. * * Possible filters, as GET params, are: * cityId: optional, numeric only * stateId, goes with placeId * latitude, optional, should not be set if placeId is set * longitude, goes with Latitude * minPrayerTimeUtc: optional, HH:MM 24 hours format, e.g 13:20 * maxPrayerTimeUtc: optional, HH:MM 24 hours format, e.g 14:00 * minInteriorSpace: optional, integer [1-5] * minParkingSpace: optional, integer [1-5] * * @return Response */ public function index() { $filters = Input::only('cityId', 'stateId', 'latitude', 'longitude', 'minPrayerTimeUtc', 'maxPrayerTimeUtc', 'minInteriorSpace', 'minParkingSpace'); $validator = Validator::make($filters, ['minPrayerTimeUtc' => 'date_format:H:i', 'maxPrayerTimeUtc' => 'date_format:H:i', 'minInteriorSpace' => 'numeric|between:1,5', 'minParkingSpace' => 'numeric|between:1,5', 'cityId' => 'integer', 'stateId' => 'integer', 'latitude' => 'numeric|between:-90,90|required_with:longitude', 'longitude' => 'numeric|between:-180,180|required_with:latitude']); if ($validator->fails()) { throw new BadRequestException($validator->errors()->first()); } $request = Mosque::query(); if ($filters['cityId'] != null) { $request->where('city', $filters['cityId']); } if ($filters['stateId'] != null) { $request->where('state', $filters['stateId']); } if ($filters['minInteriorSpace'] != null) { $request->where('interior_space', '>=', $filters['minInteriorSpace']); } if ($filters['minParkingSpace'] != null) { $request->where('parking_space', '>=', $filters['minParkingSpace']); } if ($filters['minPrayerTimeUtc'] != null) { $request->where('prayer_start', '>=', $filters['minPrayerTimeUtc']); } if ($filters['maxPrayerTimeUtc'] != null) { $request->where('prayer_start', '<=', $filters['maxPrayerTimeUtc']); } if ($filters['latitude'] != null && $filters['longitude'] != null) { $request->whereBetween('latitude', [$filters['latitude'] - 0.04, $filters['latitude'] + 0.04]); $request->whereBetween('longitude', [$filters['longitude'] - 0.04, $filters['longitude'] + 0.04]); } $mosques = $request->get(); return Response::json(array('data' => $mosques, 'status_code' => 200, 'params' => $filters), 200, [], JSON_NUMERIC_CHECK); }
public function update(SubscriptionService $subscriptionService, DeltaVCalculator $deltaV, $object_id) { if (Input::has(['status', 'visibility'])) { $object = Object::find($object_id); if (Input::get('status') == ObjectPublicationStatus::PublishedStatus) { DB::transaction(function () use($object, $subscriptionService, $deltaV) { // Put the necessary files to S3 (and maybe local) if (Input::get('visibility') == VisibilityStatus::PublicStatus) { $object->putToLocal(); } $job = (new PutObjectToCloudJob($object))->onQueue('uploads'); $this->dispatch($job); // Update the object properties $object->fill(Input::only(['status', 'visibility'])); $object->actioned_at = Carbon::now(); // Save the object if there's no errors $object->save(); // Add the object to our elasticsearch node Search::index($object->search()); // Create an award wih DeltaV $award = Award::create(['user_id' => $object->user_id, 'object_id' => $object->object_id, 'type' => 'Created', 'value' => $deltaV->calculate($object)]); // Once done, extend subscription $subscriptionService->incrementSubscription($object->user, $award); }); } elseif (Input::get('status') == "Deleted") { $object->delete(); } return response()->json(null, 204); } return response()->json(false, 400); }
/** * Create a new quicksolver user if validation of user data succeeds. * Confirmation mail with confirmation code is send to new user. * * @return link to redirect after validation of user data */ public function store() { /* * Rules for user data */ $rules = ['username' => 'required|min:6|unique:users', 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:8']; /* * Validation of input data based on validation rules */ $validator = Validator::make(Input::only('username', 'email', 'password', 'password_confirmation'), $rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator); } // Confirmation code is a random value $confirmation_code = str_random(30); /* * User will be created in db, when data is valid */ User::create(['username' => Input::get('username'), 'email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'confirmation_code' => $confirmation_code]); /* * Mail based on view 'registrationmail' including the confirmation code will be sent to user */ Mail::send('pages.registrationmail', compact('confirmation_code'), function ($message) { $message->to(Input::get('email'))->subject('Confirm your Quicksolver account!'); }); /* * Redirect user to home - page and show flash message for information */ Session::flash('message', 'Thanks for signing up to Quicksolver! Please check your mails and follow the instructions to complete the sign up procedure'); return Redirect::home(); }
/** * Update the specified resource in storage. * * @param int $id * @return \Illuminate\Http\Response */ public function update($id) { $user = User::findOrFail($id); $data = Input::only('id', 'name', 'password'); $user->update($data); return Redirect::route('users.index'); }
public function store() { if (Auth::attempt(Input::only('email', 'password'))) { return redirect()->route('admin'); } return Redirect::back()->withInput(); }
public function doRegister() { $rules = array('password' => 'required|alpha_num|min:3', 'username' => 'required|min:3', 'firstName' => 'required', 'lastName' => 'required'); // run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules); // if the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::to('register')->withErrors($validator)->withInput(Input::except('password')); // send back the input (not the password) so that we can repopulate the form } else { $credentials = Input::only('firstName', 'lastName', 'username', 'password'); $credentials['password'] = Hash::make($credentials['password']); try { $user = User::create($credentials); } catch (Exception $e) { return Response::json(['error' => 'User already exists.'], Illuminate\Http\Response::HTTP_CONFLICT); } $userdata = array('username' => Input::get('username'), 'password' => Input::get('password')); if (Auth::attempt($userdata)) { // validation successful! // redirect them to the secure section or whatever // return Redirect::to('secure'); // for now we'll just echo success (even though echoing in a controller is bad) return Redirect::to('/'); } else { // validation not successful return Redirect::to('/'); } } }
/** * Process the second intermediate contact form. */ public function send() { $input = Input::only(array('name', 'email', 'comment', 'to_email', 'to_name', 'security-code')); $input['security-code'] = $this->quickSanitize($input['security-code']); if (strlen($input['security-code']) < 2) { $message = "Please enter the security code again. Thank you!"; return view('lasallecmscontact::step_two_form', ['input' => $input, 'message' => $message]); } // Guess it couldn't hurt to run inputs through the quick sanitize... $input['name'] = $this->quickSanitize($input['name']); $input['email'] = $this->quickSanitize($input['email']); $input['comment'] = $this->quickSanitize($input['comment']); // The "to_email" comes from the LaSalleCRMContact package. If it contains an email address, // then the contact form was filled out in that package. So, let's figure out the "to" email $to_email = Config::get('lasallecmscontact.to_email'); $to_name = Config::get('lasallecmscontact.to_name'); if ($input['to_email'] != "") { $to_email = $input['to_email']; $to_name = $input['to_name']; } Mail::send('lasallecmscontact::email', $input, function ($message) use($to_email, $to_name) { $message->from(Config::get('lasallecmscontact.from_email'), Config::get('lasallecmscontact.from_name')); $message->to($to_email, $to_name)->subject(Config::get('lasallecmscontact.subject_email')); }); // Redir to confirmation page return Redirect::route('contact-processing.thankyou'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::only('first_name', 'last_name', 'email', 'password'); $command = new CreateNewUserCommand($input['email'], $input['first_name'], $input['last_name'], $input['password']); $this->commandBus->execute($command); return Redirect::to('/profile'); }
public function postLogin(LoginRequest $request) { $remember = (bool) Input::get('remember'); if (Auth::attempt(Input::only('email', 'password'), $remember)) { return redirect()->intended('admin'); } return redirect()->back(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::only('email', 'password'); if (Auth::attempt($input)) { return Redirect::intended('/profile'); } return Redirect::back()->withFlashMessage('E-mail Address and/or Password incorrect'); }
public function signin() { $credentials = Input::only('email', 'password'); if (!($token = JWTAuth::attempt($credentials))) { return Response::json(false, HttpResponse::HTTP_UNAUTHORIZED); } return Response::json(compact('token')); }
public function recover_password() { switch ($response = Password::remind(Input::only('email'))) { case Password::INVALID_USER: return Response::json(['error' => 'E-mail no registrado.'], 200); case Password::REMINDER_SENT: return Response::json(['success' => 1], 200); } }
/** * */ public function postLogin() { $credentials = Input::only('email', 'password'); $credentials['active'] = true; if (Auth::attempt($credentials, Input::has('remember'))) { return Redirect::home()->with(['flash_message' => 'Welcome back!', 'flash_level' => 'success']); } return Redirect::back()->withInput()->with(['flash_message' => 'Could not log you in.', 'flash_level' => 'danger']); }
public function handle($request, Closure $next) { $auth = Input::only('auth'); $attempt = Auth::attempt(['usuario' => $auth['auth']['user'], 'password' => $auth['auth']['passw']], false); if (!$attempt) { return response()->json(['error' => 'true', 'response' => 'Usuário ou Senha inválido', 'status_code' => '401'], 401); } return $next($request); }
public function update($id) { try { $this->roles->update($id, Input::except('role_permissions'), Input::only('role_permissions')); } catch (Exception $e) { return Redirect::back()->withInput()->withFlashDanger($e->getMessage()); } return Redirect::route('access.roles.index')->withFlashSuccess('The role was successfully updated.'); }
public function patchEditProfile($username) { $user = User::where('username', $username)->firstOrFail(); if ($user->profile->fill(Input::only(['summary', 'twitter_account', 'reddit_account', 'favorite_mission', 'favorite_mission_patch', 'favorite_quote']))->save()) { return response()->json(Lang::get('profile.updated')); } else { return response()->json(Lang::get('global.somethingWentWrong')); } }
public function login() { if (Auth::attempt(Input::only('email', 'password'))) { Session::put('success', 'U bent ingelogd.'); return redirect()->home(); } Session::put('error', 'Gegevens komen niet overeen.'); return redirect()->home(); }
public function add() { $validator = $this->getValidationFactory()->make(Input::only('name', 'email'), User::rules()); if ($validator->fails()) { return redirect()->back()->withErrors($validator); } User::create(Input::only('name', 'email')); session()->flash('flash_message', ['message' => 'Success!!!']); return redirect()->back(); }
/** * @param $name * @return mixed */ public function update($name) { if (Auth::user()->hasAccessTo('change', 'any', 'entity')) { $entity = Entity::find($name); $entity->fill(Input::only('name')); $entity->save(); BonesKeeperHelper::resetSuperAdminPermissions(); return redirect()->route('entities.index'); } }
public function signin() { $this->loginValidation->validate(Input::only('username', 'password')); if ($this->user->authenticate(Input::all())) { return Redirect::to('users/dashboard'); } else { Flash::error('Username/Password combination is invalid.'); return Redirect::back()->withInput(); } }
public function login(Request $request) { $data = Input::only('username', 'password'); $credentials = ['username' => $data['username'], 'password' => $data['password']]; if (\Auth::attempt($credentials)) { //dd(\Auth::user()); return response()->json(["success" => true], 200); } return response()->json(["success" => false], 401); }
public function index() { $input = Input::only(['read', 'limit']); try { $results['notifications'] = $this->service->initialize($input)->getAll($input); return Response::json($this->responseServices->respond($results, "Loaded Notifications"), 200); } catch (\Exception $e) { return Response::json($this->responseServices->respond($e->getMessage(), sprintf("Error Getting Notifications %s", $e->getMessage())), 422); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store($shipment) { $shipment = Auth::user()->shipments()->withUnpublished()->findOrFail($shipment); $input = Input::only(['title', 'street', 'city', 'zip']); $v = Validator::make($input, Address::$rules); if ($v->fails()) { return redirect()->back()->withErrors($v->errors()); } Auth::user()->addresses()->save(Address::create($input)); return redirect()->route('shipments.destination.index', $shipment); }
public function index() { $filters = Input::only('parent'); if ($filters['parent'] != null) { $gplacesQuery = GPlace::where('importparent', $filters['parent']); } else { $gplacesQuery = GPlace::whereNull('importparent'); } $gplaces = $gplacesQuery->get(); return Response::json(array("data" => $gplaces, "parent" => $filters['parent'], 'status_code' => 200), 200); }
protected function create() { $input = Input::only('inp'); $id = Auth::id(); $test = new Code(); $test->id = $id; $test->code = $input['inp']; $test->save(); File::put('C:\\wamp\\www\\blog\\resources\\views\\test.blade.php', $input['inp']); return view('test'); }
public function update($id) { try { $this->permissions->update($id, Input::except('permission_roles'), Input::only('permission_roles')); } catch (EntityNotValidException $e) { return Redirect::back()->with('input', Input::all())->withFlashDanger($e->validationErrors()); } catch (Exception $e) { return Redirect::back()->with('input', Input::all())->withFlashDanger($e->getMessage()); } return Redirect::route('access.roles.permissions.index')->withFlashSuccess("Permission successfully updated."); }
public function postMail() { $Inputs = Input::only("Hostname", "Username", "Password", "Email"); $Validator = Validator::make($Inputs, ["Hostname" => "required", "Username" => "required", "Email" => "required"]); if ($Validator->fails()) { return redirect()->route("instapack::mail")->withInput()->withErrors($Validator)->with("Errormessage", "test"); } /* Smtp Test et */ Storage::disk("local")->put('instapack-emails.json', json_encode($Inputs)); return redirect()->route("instapack::user"); }