/** * Create a new Larabook user * @param SaveUserRequest $request * @return string */ public function store(SaveUserRequest $request) { $user = $this->dispatchFrom(RegisterUserJob::class, $request); Auth::login($user); Flash::overlay("Glad to have you as a new Larabook member!"); return redirect(route('home')); }
public function destroy($id) { $user = User::find($id); $user->delete(); Flash::error('El usuario ' . $user->name . ' ha sido borrado con exito!'); return redirect()->route('registrar.index'); }
public function updateTask($id) { $task = Task::find($id); $task->update(Input::all()); Flash::success('Task was updated'); return redirect()->back(); }
/** * store nestable node * * @param $class * @param string|null $path * @param integer|null $id * @throws StoreException * @return array */ protected function storeNode($class, $path = null, $id = null) { DB::beginTransaction(); try { $datas = $this->request->parent != 0 || $this->request->related != 0 ? $this->getDefineDatas($class) : $this->request->all(); $this->model = $class::create($datas); $this->model->setNode($class, $this->request); // eğer başka ilişki varsa onları da ekle if ($this->opsRelation && !$this->fillModel($this->opsRelation)) { throw new StoreException($this->request->all()); } event(new $this->events['success']($this->model)); DB::commit(); if (is_null($path)) { $attribute = "{$this->name}_uc_first"; return response()->json(['id' => $this->model->id, 'name' => $this->model->{$attribute}]); } Flash::success(trans('laravel-modules-base::admin.flash.store_success')); return $this->redirectRoute($path); } catch (StoreException $e) { DB::rollback(); event(new $this->events['fail']($e->getDatas())); if (is_null($path)) { return response()->json($this->returnData('error')); } Flash::error(trans('laravel-modules-base::admin.flash.store_error')); return $this->redirectRoute($path); } }
public function destroy($id) { $article = Article::find($id); $article->delete(); Flash::error('Se ha borrado el artículo ' . $article->title . ' exitosamente!'); return redirect()->route('admin.articles.index'); }
public function submit(Request $request) { //dd(bcrypt('123456')); //dd($request->all()); $user = $this->user; $this->validate($request, ['email' => 'required|email', 'password' => 'required|confirmed|min:6']); $input = $request->all(); $findUser = User::where('email', $input['email'])->first(); //dd($findUser); if ($findUser) { if ($findUser->id === $user->id) { //dd('ok'); $user->update(['password' => bcrypt($input['password'])]); Flash::success('گذرواژه با موفقیت تغییر کرد'); Auth::logout(); return redirect(route('xadmin.index')); } else { Flash::error('اطلاعات وارد شده صحیح نمی باشد'); return redirect(route('xadmin.index')); } } else { Flash::error('اطلاعات وارد شده صحیح نمی باشد'); return redirect()->back(); } }
public function destroy($id) { $horario = Horario::find($id); $horario->delete(); Flash::error('El Horario de ' . $horario->name . ' ha sido borrado con exito!'); return redirect()->route('horarios.index'); }
public function destroy($id) { $paciente = Paciente::find($id); $paciente->delete(); Flash::error('Paciente ' . $paciente->rfc . ' ha sido borrado con exito!'); return redirect()->route('pacientes.index'); }
/** * Store a newly created resource in storage. * * @param RegisterRequest $request * @param Authenticator $auth * @return Response */ public function store(RegisterUserRequest $request, Authenticator $auth) { $user = $this->execute($request); $auth->login($user); Flash::message('Glad to have you as a new Larabook member!'); return redirect()->route('home'); }
public function store(Request $request) { $input = $request->all(); $this->dispatch(new StoreUserLessonResultCommand(Auth::id(), $input['lesson_id'], $input['quiz_result'])); Flash::success('Results Saved'); return redirect()->back(); }
public function store(Request $request) { $competitor = new Competitor($request->all()); $competitor->save(); Flash::success('Competitor ' . $competitor->name . ' se ha registrado correctamente'); return view('register.competitor.create'); }
public function saveProfile(Request $request) { $user = Auth::user(); $user->update($request->all()); Flash::success('Profil frissítve!'); return redirect()->to('profile'); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $roleId = $this->user->getRoleId($this->auth->user()->id); $permitted_pages = $this->permitted_page->permittedPages($roleId); $is_page = false; foreach ($permitted_pages as $k => $page) { if (is_numeric($k)) { if ($request->is($page)) { $is_page = true; } } } if (!$is_page) { if ($permitted_pages['access']) { return view('backend::_layouts.not_allowed'); } else { if ($permitted_pages['process']) { if ($request->method() != "GET") { Flash::warning('Sayfa Erişim Seviyeniz Bu İşlemi Gerçekleştirmenizi Engelliyor'); return redirect()->back(); } } } } return $next($request); }
/** * Check if user belongs to the specified role. * * @param Request $request * @param Closure $next * @param string|array $roles * * @return \Illuminate\Http\RedirectResponse */ public function handle(Request $request, Closure $next, $roles) { $accessDenied = true; if (!($user = $this->auth->getActiveUser())) { Flash::error(trans('dashboard::dashboard.flash.access_denied')); return redirect()->route('auth.login'); } if (!is_array($roles)) { $roles = [$roles]; } foreach ($roles as $role) { if (!($role = $this->role->getBySlug($role))) { continue; } if ($user->inRole($role)) { $accessDenied = false; } } if ($accessDenied) { Flash::error(trans('dashboard::dashboard.flash.access_denied')); // Redirect back to the previous page where request was made. return redirect()->back(); } return $next($request); }
/** * Process Registration * @param EventRegistrationFormRequest $request [description] * @return [type] [description] */ public function postRegistration(EventRegistrationFormRequest $request) { $event_id = $request->input('event_id'); $attendee_email = $request->input('attendee.email'); $event = $this->eventRepo->findById($event_id); if ($event->private) { $attendee = $this->guests->findByEmail($attendee_email); if ($attendee->isEmpty()) { $msg = "We are sorry, you have not yet been added to the guest list. Please contact the organizer of this event for more info."; return redirect()->back()->withInput()->withErrors([$msg]); } } $eventRegistrationValidator = new EventRegistrationValidator($this->eventRepo, $this->attendeeRepository); if ($eventRegistrationValidator->noEventCapacity($event_id)) { $msg = "We're sorry, the event is now at full capacity."; return redirect()->back()->withInput()->withErrors([$msg]); } $job = new RegisterAttendee($request); $this->dispatch($job); $attendee = $this->attendeeRepository->findByEventAndEmail($event_id, $attendee_email); if (empty($attendee->id)) { // Something went wrong if we're in here: the attendee should've been registered // To Do: create unique exception classes for unique handling throw new Exception("Unable to find Registered Attendee."); } Flash::success('Thank you! You have been registered! A confirmation email have been sent.'); return redirect()->route('event.payment', [$event, $attendee]); }
public function testACS(Request $request) { $mgmtServer = SiteConfig::whereParameter('mgmtServer')->first(); $apiKey = SiteConfig::whereParameter('apiKey')->first(); $secretKey = SiteConfig::whereParameter('secretKey')->first(); foreach (['mgmtServer', 'apiKey', 'secretKey'] as $setting) { if (${$setting}->data != $request->{$setting}) { ${$setting}->data = $request->{$setting}; ${$setting}->save(); } } try { $acs = app('cloudstack'); if (is_array($acs)) { Flash::error($acs['error']); return -1; } $result = $acs->listCapabilities(); if (isset($result->capability->cloudstackversion)) { Flash::success('Successfully contacted management server.'); return 1; } else { Flash::error('Unable to contact management server.'); return -1; } } catch (\Exception $e) { Flash::error($e->getMessage()); return -1; } }
public function clearCache() { Cache::flush(); Logs::add('process', "Ön Bellek Temizlendi"); Flash::success('Ön Bellek Başarıyla Temizlendi'); return redirect()->route('admin.index'); }
public function destroy($id) { $especialidad = Especialidad::find($id); $especialidad->delete(); Flash::error('La especialidad ' . $especialidad->name . ' ha sido borrada con exito!'); return redirect()->route('especialidades.index'); }
/** * Store a newly created resource in storage. * */ public function store(Request $request) { $input = $request->all(); $this->dispatch(new AddModCommand($input['users'], $input['product_id'])); Flash::success('Moderator Added'); return redirect()->back(); }
public function postUpdate($id, Request $request) { $user = Auth::getUser(); if ($user->email == $request->get('email')) { // user try to change own password $validatorRules = ['password' => 'confirmed|min:6']; } else { // user try another email $validatorRules = ['email' => 'required|email|max:255|unique:users', 'password' => 'confirmed|min:6']; } $this->validate($request, $validatorRules); $data = $request->all(); // password crypt if (isset($data['password'])) { if (empty($data['password'])) { unset($data['password']); } else { $data['password'] = bcrypt($data['password']); } } $user = User::findOrFail($id); $user->update($data); Flash::success('Benutzerdaten sind aktualisiert.'); return redirect()->action('Auth\\EditController@getEdit'); }
public function destroy($medico_id) { $permiso = Permiso::find($medico_id); $permiso->delete(); Flash::error('Permiso borrado con exito!'); return redirect()->route('medico.permisos.index'); }
/** * Creación de un nuevo proyecto * * @param ProjectRequest $request * @return \Illuminate\Http\RedirectResponse */ public function store(ProjectRequest $request) { $inputs = $request->only(['name', 'description']); $this->user->projects()->create($inputs); Flash::success('Se ha creado este nuevo proyecto'); return redirect()->route('Projects::list_path'); }
/** * Update the settings in storage. * * @param Setting $setting * @param SettingRequest $request * @return Response */ public function patchSettings(Setting $setting, SettingRequest $request) { $data = $this->storeImage($request, 'logo'); $setting->fill($data); $setting->save() == true ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail')); return redirect(route('admin.setting.index')); }
public function postPayment(PaymentFormRequest $request, $eventId, $attendeeId) { $registeredAttendee = $this->attendees->findById($attendeeId); $event = $this->events->findById($eventId); $input = $request->all(); $token = $input['stripeToken']; if (empty($token)) { Flash::error('Your order could not be processed. Please ensure javascript in enabled and try again.'); return redirect()->back(); } try { \Stripe\Stripe::setApiKey(env('STRIPE_SECRET')); $stripeCustomer = \Stripe\Customer::create(['source' => $token, 'description' => 'Stripe charge for AARMS customer: ' . $registeredAttendee->id, 'email' => $registeredAttendee->email]); $charge = \Stripe\Charge::create(['amount' => $event->price_cents, 'currency' => 'usd', 'customer' => $stripeCustomer->id, 'description' => 'Stripe charge for event: ' . $event->title]); if (!$charge) { Flash::error("Could not process Credit Card Payment"); return redirect()->back(); } else { $registeredAttendee->amount_paid = $event->price; $registeredAttendee->save(); $sendMail = new SendInvoiceEmail($registeredAttendee); $this->dispatch($sendMail); } Flash::success("Payment successful!"); return redirect()->back(); } catch (\Stripe\Error\Card $e) { Flash::error($e->getMessage()); return redirect()->back(); } }
public function postDeleteFriend($id) { $newUnFriendUser = User::find($id); $this->user->unfriend($newUnFriendUser); Flash::warning('You unfriended ' . $newUnFriendUser->name); return redirect('/'); }
public function store(PublishStatusRequest $request) { $this->dispatch(new PublishStatusCommand($request->all())); Flash::info('Your status has been updated'); // Redirects back to the page that submitted the form return Redirect::back(); }
public function update(User $user, UserRequest $request) { $user->update($request->all()); $user->roles()->sync($request->input('roleList')); Flash::success(trans('general.updated_msg')); return redirect(route('admin.users')); }
/** * Procesa el formulario de contacto * * @param ContactRequest $request * @return \Illuminate\Http\RedirectResponse */ public function sendContact(ContactRequest $request) { $contacto = Contact::create($request->all()); event(new ContactFormHasSent($contacto)); Flash::success('Mensaje enviado de manera correcta'); return redirect()->back(); }
public function destroy($id) { $medico = Medico::find($id); $medico->delete(); Flash::error('El Medico ' . $medico->name . ' ha sido borrada con exito!'); return redirect()->route('medicos.index'); }
/** * Run the seed command for the given module * @param SeedModuleRequest $request * @return mixed */ public function seed(SeedModuleRequest $request) { $output = new BufferedOutput(); Artisan::call('module:seed', ['module' => $request->module], $output); Flash::message($output->fetch()); return Redirect::route('admin.workshop.workbench.index'); }