Files
investbrain/app/Console/Commands/RefreshHoldingData.php
T

53 lines
960 B
PHP
Raw Normal View History

2024-08-29 23:36:44 -05:00
<?php
namespace App\Console\Commands;
use App\Models\Holding;
2024-08-30 20:22:28 -05:00
use App\Models\Dividend;
2024-08-29 23:36:44 -05:00
use App\Models\Transaction;
use Illuminate\Console\Command;
class RefreshHoldingData extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'holding-data:refresh';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Refresh holdings';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
// get all holdings
$holdings = Holding::get();
foreach ($holdings as $holding) {
$this->line('Refreshing ' . $holding->symbol);
2024-08-30 20:22:28 -05:00
$holding->sync();
2024-08-29 23:36:44 -05:00
}
}
}