/
home
/
techb158
/
immovalet.com
/
platform
/
plugins
/
contact
/
src
/
Exports
/
/home/techb158/immovalet.com/platform/plugins/contact/src/Exports
mkdir
upload
Name
Size
Mode
Actions
ContactExport.php
1508
0644
edit
dl
rm
Edit:
/home/techb158/immovalet.com/platform/plugins/contact/src/Exports/ContactExport.php
(1508B)
<?php namespace Botble\Contact\Exports; use Botble\Contact\Enums\ContactStatusEnum; use Botble\Table\Supports\TableExportHandler; use Maatwebsite\Excel\Events\AfterSheet; use PhpOffice\PhpSpreadsheet\Style\Alignment; class ContactExport extends TableExportHandler { /** * {@inheritDoc} */ protected function afterSheet(AfterSheet $event) { parent::afterSheet($event); $totalRows = $this->collection->count() + 1; $event->sheet ->getDelegate() ->getStyle('B1:B' . $totalRows) ->getAlignment() ->setHorizontal(Alignment::HORIZONTAL_LEFT); $event->sheet ->getDelegate() ->getStyle('C1:C' . $totalRows) ->getAlignment() ->setHorizontal(Alignment::HORIZONTAL_LEFT); for ($index = 2; $index <= $totalRows; $index++) { $status = $event->sheet->getDelegate() ->getStyle('F' . $index) ->getFont() ->getColor(); $value = $event->sheet->getDelegate() ->getCell('F' . $index) ->getValue(); if ($value == ContactStatusEnum::READ) { $status->setARGB('1d9977'); } else { $status->setARGB('dc3545'); } $event->sheet ->getDelegate() ->getCell('F' . $index) ->setValue(ContactStatusEnum::getLabel($value)); } } }
Save
cmd:
run