Added created_by field value

This commit is contained in:
Cihan Şentürk 2023-06-16 17:14:35 +03:00 committed by GitHub
parent e4c50704e5
commit d9bca73382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'));
}