Files
investbrain/resources/views/import-export/export-portfolios-button.blade.php
T

33 lines
735 B
PHP
Raw Normal View History

2024-08-07 19:00:56 -05:00
<?php
2024-08-27 22:06:10 -05:00
use App\Exports\BackupExport;
use App\Traits\Toast;
2024-08-27 22:06:10 -05:00
use Illuminate\Support\Facades\RateLimiter;
use Livewire\Volt\Component;
use Maatwebsite\Excel\Facades\Excel;
2024-08-07 19:00:56 -05:00
new class extends Component
{
2024-08-07 19:00:56 -05:00
use Toast;
// props
2024-08-07 19:00:56 -05:00
// methods
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.'));
2024-08-27 22:06:10 -05:00
return;
}
2024-08-07 19:00:56 -05:00
return Excel::download(new BackupExport, now()->format('Y_m_d').'_investbrain_backup.xlsx');
2024-08-07 19:00:56 -05:00
}
}; ?>
<div>
<x-ui.button type="submit" @click="$wire.export" spinner="export">
2024-08-07 19:00:56 -05:00
{{ __('Download Export') }}
</x-ui.button>
2024-08-07 19:00:56 -05:00
</div>