Merge pull request #2756 from CihanSenturk/master

Type issue in category import
This commit is contained in:
Cüneyt Şentürk 2022-11-21 17:27:58 +03:00 committed by GitHub
commit 90ceeab645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,15 @@ class Categories extends Import
return new Model($row);
}
public function map($row): array
{
$row = parent::map($row);
$row['type'] = $this->getCategoryType($row['type']);
return $row;
}
public function rules(): array
{
return (new Request())->rules();

View File

@ -60,6 +60,11 @@ trait Import
return is_null($id) ? $id : (int) $id;
}
public function getCategoryType($type)
{
return array_key_exists($type, config('type.category')) ? $type : 'other';
}
public function getContactId($row, $type = null)
{
$id = isset($row['contact_id']) ? $row['contact_id'] : null;