From d9bca733828a88cb042d6bd778fcdcf4ea225fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Fri, 16 Jun 2023 17:14:35 +0300 Subject: [PATCH] Added created_by field value --- app/Abstracts/Export.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Abstracts/Export.php b/app/Abstracts/Export.php index 5ad500d08..068d3c2f3 100644 --- a/app/Abstracts/Export.php +++ b/app/Abstracts/Export.php @@ -55,6 +55,11 @@ abstract class Export implements FromCollection, HasLocalePreference, ShouldAuto 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')); }