fixed recurring import has row issue
This commit is contained in:
parent
b34446c63b
commit
63d4a68f65
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue