Skip to content

Commit

Permalink
Added created_by field value
Browse files Browse the repository at this point in the history
  • Loading branch information
CihanSenturk committed Jun 16, 2023
1 parent e4c5070 commit d9bca73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Abstracts/Export.php
Expand Up @@ -55,6 +55,11 @@ public function map($model): array
foreach ($this->fields as $field) {
$value = $model->$field;

// created_by is equal to the owner id. Therefore, the value in export is owner email.
if ($field == 'created_by') {
$value = $model->owner->email ?? null;
}

if (in_array($field, $date_fields)) {
$value = ExcelDate::PHPToExcel(Date::parse($value)->format('Y-m-d'));
}
Expand Down

0 comments on commit d9bca73

Please sign in to comment.