Category : sweetalert2

My last version was before the update v2.4.2 I used this code to display notifications messages, in livewire component: $this->emit(‘toast’, ‘success’,’test ok’); js: let Swal = require(‘sweetalert2’); const Toast = Swal.mixin({ toast: true, position: ‘center’, showConfirmButton: false, timer: 4000, timerProgressBar: true, customClass: { title: ‘persian-font’, }, didOpen: (toast) => { toast.addEventListener(‘mouseenter’, Swal.stopTimer) toast.addEventListener(‘mouseleave’, Swal.resumeTimer) } ..

Read more

I added sweetalert2 ( version 11.1.5 ) into my Laravel 8 / livewire 2.5 / alpinejs 3 / tailwindcss: 2.2 app with npm install sweetalert2 command and importing and testing in resources/js/app.js I see next message : require(‘./bootstrap’); import Alpine from ‘alpinejs’; window.Alpine = Alpine; Alpine.start(); require(‘@fortawesome/fontawesome-free/js/all.min.js’); import Swal from ‘sweetalert2’; window.Swal = Swal; Swal.fire(‘Test!’, ..

Read more

i’m try to use sweetalert2 in livewire – Instead of deleting one post, all posts will be deleted what is my problem? post.list.blade <button wire:click="deleteConfirm" type="button">delete</button> component public function deleteConfirm(){$this->emit(‘swal’, ‘are u sure?’, ‘warning’);} and public function delete(){$this->post->delete();} my js: const Swal = Swal.mixin({ position: ‘center’, showConfirmButton: true, }) document.addEventListener(‘livewire:load’, () => { Livewire.on(‘swal’, (message,type) ..

Read more

i’m try to use sweetalert2 in livewire – Instead of deleting one post, all posts will be deleted what is my problem? post.list.blade <button wire:click="deleteConfirm" type="button">delete</button> component public function deleteConfirm(){$this->emit(‘swal’, ‘are u sure?’, ‘warning’);} and public function delete(){$this->post->delete();} my js: const Swal = Swal.mixin({ position: ‘center’, showConfirmButton: true, }) document.addEventListener(‘livewire:load’, () => { Livewire.on(‘swal’, (message,type) ..

Read more

I want to show a Sweet Alert 2 confirm message to user after submitting the form like this: <form id="myForm" data-flag="0" action="" method="POST"> @csrf <input type="checkbox" id="btn-submit" name="wallet_checked" onchange="this.form.submit();"> </form> As you can see I have used onchange="this.form.submit();" to submit the form without using submit button and it works fine. Then I tried adding this ..

Read more

I am trying to implement a Stripe Checkout button into a Sweet Alert 2 modal. Here is the SweetAlert2 code: Swal.mixin({ input: ‘text’, confirmButtonText: ‘Continue &rarr;’, showCancelButton: true, progressSteps: [‘1’, ‘2’] }).queue([{ title: ‘…’, html: ‘<div class=&quot;table w-full&quot;>’ + ‘…’ + ‘</div>’ }, ‘Step 2’ ]).then((result) => { if (result.value) { Swal.fire({ title: ‘…’, showConfirmButton: ..

Read more

I am calling an Alert::question() in my Middleware to check if user has email filled or not every time user logs in to dashboard Middleware public function handle(Request $request, Closure $next) { if(!auth()->user()->email) { Alert::question(trans(‘errors.blank_email’))->showCloseButton()->timerProgressBar(); } return $next($request); } Result: My issue: In above command I need to make sure that when user clicks ok ..

Read more

I have a problem using sweetalert in laravel how to make a confirmation alert using Alert::questionto delete data in the table? this is my code, but the alert appear after the data was deleted, how to fix this problem? public function delete($id) {Alert::question(‘Benar Ingin Hapus data?’,’data tidak dapat dikembalikan’)->persistent(‘Close’); DB::table(‘daftar_pelanggans’)->where(‘id’,$id)->delete(); return redirect()->back();} [2]: https://i.stack.imgur.com/aW0HF.png this ..

Read more

I have a login blade which contains a form: <form method="POST" action="{{ route(‘login’) }}"> @csrf <div class="field"> <span class="fas fa-user"></span> <input type="email" name="email" required> <label style="right:0;" class="BFarnaz">Email</label> @error(’email’) alert()->success(‘{{ $message }}’,’message’)->persistent(‘Ok’); @enderror </div> <div class="field"> <span class="fas fa-lock"></span> <input type="password"> <label style="right:0;" class="BFarnaz">Password</label> @error(‘password’) alert()->success(‘{{ $message }}’,’message’)->persistent(‘Ok’); @enderror </div> <button class="BJadidBold">Login</button> </form> I have also ..

Read more

I have Excel Upload in Laravel-5.8 using Maatwebsites Controller public function import(Request $request){ $request->validate([ ‘file’ => ‘required|max:10000|mimes:xlsx,xls’, ]); $path1 = $request->file(‘file’)->store(‘temp’); $path=storage_path(‘app’).’/’.$path1; try{ Excel::import(new LeavesImport, $path); } catch (MaatwebsiteExcelValidatorsValidationException $e) { $failures = $e->failures(); Log::error($e); $errormessage = ""; foreach ($failures as $failure) { $errormess = ""; foreach($failure->errors() as $error) { $errormess = $errormess.$error; } $errormessage ..

Read more

I have Created a Front end Page where user can delete a row from the table. I have added the Confirmation message as: <a rel="tooltip" class="btn btn-danger btn-link" href="{{action(‘[email protected]’,$row[‘shipment_id’])}}" onclick = "if (! confirm(‘Confirm: Press OK to delete the Entry. Shipment ID: {{$row[‘shipment_id’]}}’)) { return false; }"style="color: red;"> <i class="material-icons">close</i></a> Now I want to replace ..

Read more