Files
investbrain/app/Imports/BackupImport.php
T

43 lines
1.1 KiB
PHP
Raw Normal View History

2024-08-07 18:29:23 -05:00
<?php
namespace App\Imports;
use App\Imports\Sheets\PortfoliosSheet;
use Illuminate\Support\Facades\Artisan;
2024-08-29 22:26:04 -05:00
use App\Imports\Sheets\DailyChangesSheet;
2024-08-07 18:29:23 -05:00
use App\Imports\Sheets\TransactionsSheet;
use Maatwebsite\Excel\Events\AfterImport;
2024-08-07 18:29:23 -05:00
use Maatwebsite\Excel\Concerns\Importable;
2024-08-29 22:26:04 -05:00
use Maatwebsite\Excel\Concerns\WithEvents;
2024-09-18 20:14:30 -05:00
use App\Console\Commands\RefreshMarketData;
use App\Console\Commands\RefreshDividendData;
2024-08-07 18:29:23 -05:00
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
2024-08-29 22:26:04 -05:00
class BackupImport implements WithMultipleSheets, WithEvents
2024-08-07 18:29:23 -05:00
{
use Importable;
2024-08-29 22:26:04 -05:00
/**
* @return array
*/
public function registerEvents(): array
{
return [
AfterImport::class =>
2024-09-18 23:03:23 -05:00
fn() => Artisan::queue(RefreshMarketData::class, ['--force' => true])->chain([
fn() => Artisan::call(RefreshDividendData::class)
])
2024-08-29 22:26:04 -05:00
];
}
2024-08-07 18:29:23 -05:00
public function sheets(): array
{
return [
'Portfolios' => new PortfoliosSheet,
2024-08-28 22:06:47 -05:00
'Transactions' => new TransactionsSheet,
2024-08-29 21:39:59 -05:00
'Daily Changes' => new DailyChangesSheet,
2024-08-07 18:29:23 -05:00
];
}
}