fixed recurring import has row issue

This commit is contained in:
Cihan Şentürk 2024-02-23 11:48:40 +03:00 committed by GitHub
parent b34446c63b
commit 63d4a68f65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View File

@ -60,4 +60,22 @@ class RecurringBills extends Import
return $rules;
}
//This function is used in import classes. If the data in the row exists in the database, it is returned.
public function hasRow($row)
{
$has_row = $this->model::billRecurring()->get($this->columns)->each(function ($data) {
$data->setAppends([]);
$data->unsetRelations();
});
$search_value = [];
//In the model, the fields to be searched for the row are determined.
foreach ($this->columns as $key) {
$search_value[$key] = isset($row[$key]) ? $row[$key] : null;
}
return in_array($search_value, $has_row->toArray());
}
}

View File

@ -60,4 +60,22 @@ class RecurringInvoices extends Import
return $rules;
}
//This function is used in import classes. If the data in the row exists in the database, it is returned.
public function hasRow($row)
{
$has_row = $this->model::invoiceRecurring()->get($this->columns)->each(function ($data) {
$data->setAppends([]);
$data->unsetRelations();
});
$search_value = [];
//In the model, the fields to be searched for the row are determined.
foreach ($this->columns as $key) {
$search_value[$key] = isset($row[$key]) ? $row[$key] : null;
}
return in_array($search_value, $has_row->toArray());
}
}