Fixed import created_by issue
This commit is contained in:
parent
0d0e8820e4
commit
0fa3bf4ab1
|
|
@ -49,9 +49,7 @@ abstract class Import implements HasLocalePreference, ShouldQueue, SkipsEmptyRow
|
|||
$row['company_id'] = company_id();
|
||||
|
||||
// created_by is equal to the owner id. Therefore, the value in export is owner email.
|
||||
if (isset($row['created_by'])) {
|
||||
$row['created_by'] = $this->getCreatedById($row);
|
||||
}
|
||||
$row['created_by'] = $this->getCreatedById($row);
|
||||
|
||||
$row['created_from'] = $this->getSourcePrefix() . 'import';
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ trait Import
|
|||
|
||||
public function getCreatedById($row)
|
||||
{
|
||||
if (empty($row['created_by'])) {
|
||||
return $this->user->id;
|
||||
}
|
||||
|
||||
$user = user_model_class()::where('email', $row['created_by'])->first();
|
||||
|
||||
if (! empty($user)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue