wip
This commit is contained in:
@@ -10,6 +10,7 @@ use Carbon\CarbonPeriod;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Investbrain\Frankfurter\Frankfurter;
|
use Investbrain\Frankfurter\Frankfurter;
|
||||||
|
|
||||||
class CurrencyRate extends Model
|
class CurrencyRate extends Model
|
||||||
@@ -156,15 +157,16 @@ class CurrencyRate extends Model
|
|||||||
$rates = array_merge($rates, Arr::get($chunkRates, 'rates', []));
|
$rates = array_merge($rates, Arr::get($chunkRates, 'rates', []));
|
||||||
}
|
}
|
||||||
|
|
||||||
dump('done with frankf');
|
dump('done with frankf', count($rates));
|
||||||
|
|
||||||
// loop through each date
|
// loop through each date
|
||||||
$updates = [];
|
$updates = [];
|
||||||
foreach ($period as $date) {
|
foreach ($period as $date) {
|
||||||
|
|
||||||
try {
|
|
||||||
$lookupDate = self::getNearestPastDate($date, $rates);
|
$lookupDate = self::getNearestPastDate($date, $rates);
|
||||||
|
|
||||||
|
Log::warn($lookupDate, isset($rates[$lookupDate->toDateString()]));
|
||||||
|
|
||||||
if (is_null($lookupDate)) {
|
if (is_null($lookupDate)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -181,9 +183,7 @@ class CurrencyRate extends Model
|
|||||||
'created_at' => now()->toDateTimeString(),
|
'created_at' => now()->toDateTimeString(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
|
||||||
dump($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dump('inserting');
|
dump('inserting');
|
||||||
|
|||||||
Reference in New Issue
Block a user