2024-08-07 19:00:56 -05:00
|
|
|
<?php
|
|
|
|
|
|
2024-08-27 22:06:10 -05:00
|
|
|
use App\Exports\BackupExport;
|
2025-09-26 17:41:28 -05:00
|
|
|
use App\Traits\Toast;
|
2024-08-27 22:06:10 -05:00
|
|
|
use Illuminate\Support\Facades\RateLimiter;
|
2025-09-26 17:41:28 -05:00
|
|
|
use Livewire\Volt\Component;
|
|
|
|
|
use Maatwebsite\Excel\Facades\Excel;
|
2024-08-07 19:00:56 -05:00
|
|
|
|
2025-09-26 17:41:28 -05:00
|
|
|
new class extends Component
|
|
|
|
|
{
|
2024-08-07 19:00:56 -05:00
|
|
|
use Toast;
|
|
|
|
|
|
|
|
|
|
// props
|
2025-09-26 17:41:28 -05:00
|
|
|
|
2024-08-07 19:00:56 -05:00
|
|
|
// methods
|
2025-09-26 17:41:28 -05:00
|
|
|
public function export()
|
|
|
|
|
{
|
|
|
|
|
if (! RateLimiter::attempt('export:'.auth()->user()->id, $perMinute = 3, fn () => null)) {
|
2024-08-27 22:06:10 -05:00
|
|
|
|
|
|
|
|
$this->error(__('Hang on! You\'re doing that too much.'));
|
2025-09-26 17:41:28 -05:00
|
|
|
|
2024-08-27 22:06:10 -05:00
|
|
|
return;
|
|
|
|
|
}
|
2024-08-07 19:00:56 -05:00
|
|
|
|
2025-09-26 17:41:28 -05:00
|
|
|
return Excel::download(new BackupExport, now()->format('Y_m_d').'_investbrain_backup.xlsx');
|
2024-08-07 19:00:56 -05:00
|
|
|
}
|
|
|
|
|
}; ?>
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-09-26 17:41:28 -05:00
|
|
|
<x-ui.button type="submit" @click="$wire.export" spinner="export">
|
2024-08-07 19:00:56 -05:00
|
|
|
{{ __('Download Export') }}
|
2025-09-26 17:41:28 -05:00
|
|
|
</x-ui.button>
|
2024-08-07 19:00:56 -05:00
|
|
|
</div>
|