first commit

This commit is contained in:
ExtraNetwork
2026-05-12 17:04:54 +03:00
commit e5c4b6aa13
1425 changed files with 284735 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
<?php
namespace App\Export;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Input;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class PropertyCompetitorExport implements FromArray, WithHeadings, ShouldAutoSize, WithEvents
{
public function __construct($dataTableData = "")
{
$this->dataTableData = $dataTableData;
}
public function registerEvents(): array
{
return [
AfterSheet::class => function(AfterSheet $event) {
$cellRange = 'A1:Q1'; // All headers
$event->sheet->getDelegate()->getStyle($cellRange)->getFont()->setBold(true);
//$event->sheet->setAutoFilter($cellRange);
$event->sheet->setTitle('Property Competitor Export');
},
];
}
public function headings(): array
{
$header = [
'Property'
];
foreach ($this->dataTableData['date'] as $date) {
$header[] = $date;
}
$header[] = 'Currency';
return $header;
}
public function array(): array
{
$dataTableData = [];
foreach ($this->dataTableData['value'] as $propertyKey => $propertyValue) {
$dataTableData[$propertyKey] = [
'name' => $this->dataTableData['property'][$propertyKey]
];
foreach ($propertyValue as $dateKey => $value) {
$dataTableData[$propertyKey][$dateKey] = $value['amount'];
}
$dataTableData[$propertyKey]['currency'] = $value['currency'];
}
return [$dataTableData];
}
}