wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports\Helper;
|
||||
|
||||
use App\Models\StatisticFixtures;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Spatie\SimpleExcel\SimpleExcelReader;
|
||||
|
||||
class ImportFixtures
|
||||
{
|
||||
public static function run(string $filePath): void
|
||||
{
|
||||
SimpleExcelReader::create(storage_path('app/public/' . $filePath))
|
||||
->getRows()
|
||||
->chunk(200)
|
||||
->each(function (LazyCollection $chunk) {
|
||||
|
||||
foreach ($chunk as $row) {
|
||||
|
||||
$row = array_values($row);
|
||||
|
||||
/*
|
||||
0 => 1
|
||||
1 => 87
|
||||
2 => 3614
|
||||
3 => 1491
|
||||
4 => DateTimeImmutable @1777334400 {#2722 ▶}
|
||||
5 => 0.90433699503783
|
||||
6 => 1.035168989838
|
||||
*/
|
||||
|
||||
StatisticFixtures::updateOrCreate(
|
||||
[
|
||||
'sport_id' => (int) $row[0],
|
||||
'league_id' => (int) $row[1],
|
||||
'home_id' => (int) $row[2],
|
||||
'away_id' => (int) $row[3],
|
||||
'starttime' => Carbon::parse($row[4])->toDateTimeString(),
|
||||
],
|
||||
['exp_home' => (float) $row[5], 'exp_away' => (float) $row[6]]
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user