HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/ghayatcom/ghayatcom-api/app/Exports/LanguageFileExport.php
<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;

class LanguageFileExport implements FromCollection, WithHeadings
{
    protected $translations;

    public function __construct(array $translations)
    {
        $this->translations = $translations;
    }

    /**
    * @return \Illuminate\Support\Collection
    */
    public function collection()
    {
        $data = [];
        
        foreach ($this->translations as $index => $module) {

            foreach ($module as $key => $value) {
                $data[] = [
                    'module' => $index,
                    'key' => $key,
                    'english' => $value,
                    'translation' => ''
                ];
            }
        }
        
        return collect($data);
    }

    public function headings(): array
    {
        return [
            'Module',
            'Key',
            'English',
            'Translation'
        ];
    }
}