wip
This commit is contained in:
1 parent
b89410c8f1
commit
e09e42ab41
2 files changed
+9
-3
No files matched your search
@@ -9,10 +9,13 @@ use Spatie\SimpleExcel\SimpleExcelReader;
|
||||
|
||||
class ImportDetails
|
||||
{
|
||||
public static $teams = [];
|
||||
|
||||
public static function run(string $filePath): void
|
||||
{
|
||||
// StatistikoDetail::query()->update(['last_import' => 'no']);
|
||||
StatistikoDetail::query()->update(['last_import' => 'no']);
|
||||
|
||||
self::$teams = [];
|
||||
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
|
||||
->getRows()
|
||||
->chunk(1000)
|
||||
@@ -20,6 +23,7 @@ class ImportDetails
|
||||
|
||||
$collection = [];
|
||||
foreach ($chunk as $row) {
|
||||
self::$teams[] = $row['ss_team_id'];
|
||||
if ($row['player_name'] != '') {
|
||||
$row['is_active'] = 1;
|
||||
$row['last_import'] = 'yes';
|
||||
@@ -50,6 +54,8 @@ class ImportDetails
|
||||
]);
|
||||
});
|
||||
|
||||
// StatistikoDetail::where('last_import', 'no')->update(['is_active' => 0, 'ss_team_id' => 0]);
|
||||
self::$teams = array_unique(self::$teams);
|
||||
|
||||
StatistikoDetail::where('last_import', 'no')->whereIn('ss_team_id', self::$teams)->update(['is_active' => 0, 'ss_team_id' => 0]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user