示例#1
0
 /**
  * Update the role.
  * @return mixed
  */
 public function update($memberId, Request $request)
 {
     $member = Management::find($memberId);
     if ($member->status == 0) {
         foreach ($request->zone as $key => $zone) {
             $member->zone()->create(['zone' => $zone]);
         }
         $member->grade()->create(['grade' => $request->grade, 'number' => $request->number]);
         $member->status = 1;
         $member->save();
     } else {
         if ($member->status == 1) {
             $massage = "Already Approve";
         } else {
             $massage = "Reporter Not Found";
         }
         Flash::error($massage);
         return $this->redirect(handles('blupl/management::approval'));
     }
     Mailer::send('blupl/management::email.update', ['yoo' => 'Yoo'], function ($m) use($member) {
         $m->to($member->email);
         $m->from('*****@*****.**');
         $m->subject('Thank you for your Registration');
     });
     Flash::success($member->name . ' Approved Successfully');
     return $this->redirect(handles('blupl/management::approval/all'));
 }
示例#2
0
 public function destroy($medico_id)
 {
     $permiso = Permiso::find($medico_id);
     $permiso->delete();
     Flash::error('Permiso borrado con exito!');
     return redirect()->route('medico.permisos.index');
 }
示例#3
0
 /**
  * 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);
 }
 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');
 }
示例#5
0
 public function destroy(Request $request)
 {
     $model = Category::with('articles', 'announcements')->find($request->id);
     if (empty($model)) {
         Flash::error('Impossible de supprimer cette catégorie.');
         return Redirect::back();
     }
     $announcements = $model->announcements();
     $articles = $model->articles();
     if (!empty($announcements)) {
         foreach ($announcements as $a) {
             $a->update(['category_id' => 1]);
         }
     }
     if (!empty($articles)) {
         foreach ($articles as $a) {
             $a->update(['category_id' => 1]);
         }
     }
     $name = $model->name;
     $model->delete();
     makeModification('categories', 'The category « ' . $name . ' » has been removed.');
     Flash::success('La catégorie a bien été supprimé.');
     return Redirect::back();
 }
示例#6
0
 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');
 }
示例#7
0
 /**
  * Update account information.
  *
  * @param \Illuminate\Http\Request $request
  * @param                          $id
  *
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function update(Request $request, $id)
 {
     if ($request->input('action') == 'update_account') {
         try {
             $this->userRepositoryInterface->update($request->all(), $id);
         } catch (FormValidationException $e) {
             Flash::error($e->getMessage());
             return redirect()->route('account.edit')->withErrors($e->getErrors())->withInput();
         } catch (UsersException $e) {
             Flash::error($e->getMessage());
             return redirect()->route('dashboard.index');
         }
         Flash::success(trans('dashboard::dashboard.flash.account.success'));
         return redirect()->route('account.edit');
     }
     if ($request->input('action') == 'change_password') {
         try {
             $this->userRepositoryInterface->updatePassword($request->all());
         } catch (FormValidationException $e) {
             Flash::error($e->getMessage());
             return redirect()->route('account.edit')->withErrors($e->getErrors());
         } catch (AuthenticationException $e) {
             Flash::error(trans('dashboard::dashboard.flash.password.fail'));
             return redirect()->route('account.edit');
         }
         Flash::success(trans('dashboard::dashboard.flash.password.success'));
         return redirect()->route('account.edit');
     }
 }
示例#8
0
 public function destroy($id)
 {
     $codigo = Cie::find($id);
     $codigo->delete();
     Flash::error('El Codigo ha sido borrado con exito!');
     return redirect()->route('codigos.index');
 }
 public function destroy($id)
 {
     $user = Userdoctor::find($id);
     $user->delete();
     Flash::error('El Medico ' . $user->Fullname . ' ha sido borrado con exito!');
     return redirect()->route('registrar_medicos.index');
 }
示例#10
0
 /**
  * Attempt to activate an account
  *
  * @param string $confirmation_code
  * @return void
  */
 public function activateAccount($confirmation_code)
 {
     if (!$confirmation_code) {
         return redirect()->to('/');
     }
     $confirmation = AccountConfirmation::where('code', '=', $confirmation_code)->first();
     if ($confirmation == null) {
         Flash::error('Invalid confirmation code.');
         return redirect()->to('/');
     }
     $user = $confirmation->user;
     if ($user == null) {
         Flash::error('The user associated with this confirmation code either does not exist or has been deleted.');
         return redirect()->to('/');
     }
     if ($confirmation->hasExpired()) {
         Flash::error('That confirmation code has expired.');
         return redirect()->to('/');
     }
     if ($user->isConfirmed()) {
         Flash::error('The user associated with this confirmation code has already confirmed their account.');
         return redirect()->to('/');
     }
     $user->confirmed = 1;
     if ($user->save()) {
         Flash::success('Your account has been activated. You now have access to all the features that confirmed members get.');
         $confirmation->delete();
         return redirect()->to('/');
     } else {
         Flash::error('Your account could not be activated.');
         return redirect()->to('/');
     }
 }
示例#11
0
 public function destroy($id)
 {
     $user = User::find($id);
     $user->delete();
     Flash::error('El usuario se ha elimindado');
     return redirect()->route('admin.users.index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $student = Auth::user();
     $course_id = $request["course_id"];
     $questions = Question::where('course_id', '=', $course_id)->get();
     if (count($questions) <= 0) {
         Flash::error('There was a problem processing your request.');
         return redirect()->route('registration.index');
     }
     $question_count = 0;
     $passed_count = 0;
     foreach ($questions as $que) {
         $question_count = $question_count + 1;
         $keyword_found = 0;
         $answer_array = explode(',', $que->answers);
         $students_reply_array = explode(' ', $request[$que->id]);
         $students_reply = $request[$que->id];
         foreach ($answer_array as $keyword) {
             if (strpos($students_reply, $keyword) !== false) {
                 $keyword_found = $keyword_found + 1;
             }
         }
         if ($keyword_found == count($answer_array)) {
             $passed_count = $passed_count + 1;
         }
     }
     $percent = $passed_count / $question_count * 100;
     Exam::create(['course_id' => $course_id, 'student_id' => $student->id, 'score_percentage' => $percent]);
     Flash::success('Answer sheet submitted successfully.');
     return redirect()->route('registration.index');
 }
示例#13
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $periodo = Periodo::find($id);
     $periodo->delete();
     Flash::error('periodo borrado con exito!');
     return redirect()->route('periodos.index');
 }
示例#14
0
 public function store(Request $request)
 {
     $file = $request->file('file');
     $fileName = $request->input('file_name');
     $fileName = $fileName ?: $file->getClientOriginalName();
     $bulk = Bulk::create(['file_name' => $fileName]);
     if ($file->getClientMimeType() != "text/csv" && $file->getClientOriginalExtension() != "csv") {
         $bulk->result = "Invalid File Type";
         $bulk->mime_type = $file->getClientMimeType();
         $bulk->file_extension = $file->getClientOriginalExtension();
         $bulk->save();
         Flash::error('File type invalid.  Please use a CSV file format.');
         return redirect()->back();
     }
     $csvFile = new CsvFile($file);
     foreach ($csvFile as $row) {
         $indexArray[] = $row;
     }
     for ($i = 0; $i < count($indexArray); $i++) {
         $eraserArray[$i]['MAC'] = $indexArray[$i][0];
         $eraserArray[$i]['TLE'] = $indexArray[$i][1];
         $eraserArray[$i]['BULK_ID'] = $bulk->id;
     }
     $this->dispatch(new EraseTrustList($eraserArray));
     $bulk->result = "Processed";
     $bulk->mime_type = $file->getClientMimeType();
     $bulk->file_extension = $file->getClientOriginalExtension();
     $bulk->process_id = $fileName . '-' . Carbon::now()->timestamp;
     $bulk->save();
     $file->move(storage_path() . '/uploaded_files/', $fileName);
     Flash::success("File loaded successfully!  Check the Bulk Process table for progress on {$bulk->process_id}.");
     $bulks = Bulk::all();
     return view('bulk.index', compact('bulks'));
 }
 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();
     }
 }
示例#16
0
 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');
 }
示例#17
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $name_or_email = $this->input('name_or_email');
     $password = $this->input('password');
     $db_field = filter_var($name_or_email, FILTER_VALIDATE_EMAIL) ? 'email' : 'name';
     $user = User::where($db_field, '=', $name_or_email)->first();
     if ($db_field == 'name') {
         $name_change = NameChange::where('old_name', '=', $name_or_email)->first();
         if ($name_change != null) {
             // Username used to be the input, but it was changed
             Flash::error('It seems like you\'re trying to log in with a username that has changed. Please use your new username.');
             return false;
         }
     }
     if ($user == null || !$user) {
         Flash::error('User not found');
         return false;
     }
     if (!Hash::check($password, $user->password)) {
         Flash::error('Invalid password');
         return false;
     }
     if (Auth::attempt([$db_field => $name_or_email, 'password' => $password], $this->has('remember'))) {
         return true;
     } else {
         Flash::error('You could not be logged in due to an unknown error.');
         return false;
     }
     return false;
 }
 public function postDeclineFriend($id)
 {
     $declinedFriend = User::find($id);
     $this->user->denyFriendRequest($declinedFriend);
     Flash::error('You have declined the friend request for ' . $declinedFriend->name);
     return redirect('/');
 }
 /**
  * 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);
     }
 }
 /**
  * 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 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');
 }
示例#22
0
 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');
 }
示例#23
0
 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();
     }
 }
 /**
  * Authenticate a Lecturer
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function auth(SimpleLoginRequest $request)
 {
     $this->AuthorizeAndRedirect('guest');
     $email = $request->input("username");
     $password = $request->input("password");
     $remember = $request->input("remember");
     try {
         $user = User::where('email', '=', $email)->firstOrFail();
         if (!$user->hasRole('student')) {
             throw new ModelNotFoundException('Not Student');
         }
         if ($user->hasRole('admin')) {
             throw new ModelNotFoundException('Not Student');
         }
         if ($user->hasRole('lecturer')) {
             throw new ModelNotFoundException('Not Student');
         }
         if (Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
             return Redirect::route('question.index');
         }
         throw new ModelNotFoundException('Not Student');
     } catch (ModelNotFoundException $e) {
         $this->errorMessage = "Student with specified Email and Password could not be found.";
         Flash::error($this->errorMessage);
         return Redirect::route('student/login')->withInput($request->all());
     }
 }
示例#25
0
 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');
 }
 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;
     }
 }
示例#27
0
 /**
  * store Business
  *
  * @param  BusinessFormRequest $request Business form Request
  * @return Response                     Redirect
  */
 public function store(BusinessFormRequest $request)
 {
     $this->log->info('Manager\\BusinessController@store');
     // Search Existing
     $existingBusiness = Business::withTrashed()->where(['slug' => $request->input('slug')])->first();
     // If found
     if ($existingBusiness !== null) {
         $this->log->info("Manager\\BusinessController@store: Found existing businessId:{$existingBusiness->id}");
         // If owned, restore
         if (auth()->user()->isOwner($existingBusiness)) {
             $this->log->info("Manager\\BusinessController@store: Restoring owned businessId:{$existingBusiness->id}");
             $existingBusiness->restore();
             Flash::success(trans('manager.businesses.msg.store.restored_trashed'));
             return redirect()->route('manager.business.service.create', $existingBusiness);
         }
         # If not owned, return message
         $this->log->info("Manager\\BusinessController@store: Already taken businessId:{$existingBusiness->id}");
         Flash::error(trans('manager.businesses.msg.store.business_already_exists'));
         return redirect()->route('manager.business.index');
     }
     // Register new Business
     $business = new Business($request->all());
     $category = Category::find($request->get('category'));
     $business->strategy = $category->strategy;
     $business->category()->associate($category);
     $business->save();
     auth()->user()->businesses()->attach($business);
     auth()->user()->save();
     // Generate local notification
     $business_name = $business->name;
     Notifynder::category('user.registeredBusiness')->from('App\\User', auth()->user()->id)->to('App\\Business', $business->id)->url('http://localhost')->extra(compact('business_name'))->send();
     // Redirect success
     Flash::success(trans('manager.businesses.msg.store.success'));
     return redirect()->route('manager.business.service.create', $business);
 }
示例#28
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $message = Message::findOrFail($id);
     $message->delete();
     $message = trans('messages.message_successfully_deleted');
     Flash::error($message);
     return redirect()->route('admin.messages.index');
 }
示例#29
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->user()->is('admin')) {
         return $next($request);
     }
     Flash::error('Unauthorized. Contact ' . env('SPACE_NAME') . ' for more details.');
     return redirect('/');
 }
 public function destroy($id)
 {
     $practicante = Practicante::find($id);
     $titulo = $practicante->name;
     $practicante->delete();
     Flash::error("El practicante " . $titulo . " ha sido eliminada de manera exitosa!");
     return redirect()->route('admin.practicantes.index');
 }