Type issue in category import
This commit is contained in:
parent
9a0a3775ac
commit
b619ffbb85
@ -13,6 +13,15 @@ class Categories extends Import
|
|||||||
return new Model($row);
|
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
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return (new Request())->rules();
|
return (new Request())->rules();
|
||||||
|
@ -60,6 +60,11 @@ trait Import
|
|||||||
return is_null($id) ? $id : (int) $id;
|
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)
|
public function getContactId($row, $type = null)
|
||||||
{
|
{
|
||||||
$id = isset($row['contact_id']) ? $row['contact_id'] : null;
|
$id = isset($row['contact_id']) ? $row['contact_id'] : null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user