Skip to content

Commit

Permalink
Remove reused table instance
Browse files Browse the repository at this point in the history
  • Loading branch information
hasanakg committed Feb 8, 2024
1 parent a97ba8d commit ab52b7f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/Jobs/ImportCSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public function handle(CSVImportReader $reader)

// Log::info('$newArray', $newArray);

DB::transaction(function () use ($reader, $filepath, $mismatches_per_upload_user, $mismatch_attrs) {

$reader->lines($filepath)->each(function ($mismatchLine) use ($mismatches_per_upload_user, $mismatch_attrs) {
DB::transaction(function () use ($reader, $filepath, $mismatch_attrs) {

$reader->lines($filepath)->each(function ($mismatchLine) use ($mismatch_attrs) {
$mismatches_per_upload_user = DB::table('mismatches');
$new_mismatch = Mismatch::make($mismatchLine);

$collection = collect($new_mismatch->getAttributes());
Expand All @@ -92,9 +92,13 @@ public function handle(CSVImportReader $reader)
}
});


// we add first because there might be duplicates already, so this might return more than 1 result
$row_in_db = $mismatches_per_upload_user->select($mismatch_attrs)->where($newArray);
$row_in_db_get = $row_in_db->get();
// dump($newArray);
// dump($row_in_db->toSql());
// dump($row_in_db_get->count());
Log::info("row_in_db: " . json_encode($row_in_db_get));

// var_dump($mismatches_per_upload_user->get()->count());
Expand Down

0 comments on commit ab52b7f

Please sign in to comment.