%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/apache/htdocs/app/Exports/
Upload File :
Create Path :
Current File : //usr/local/apache/htdocs/app/Exports/ClientExport.php

<?php

namespace App\Exports;

use App\Models\User;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;

class ClientExport implements FromCollection,WithMapping, WithHeadings
{
    /**
    * @return \Illuminate\Support\Collection
    */
    
    public function collection()
    {
        $clients = User::role('client')->orderBy('id', 'asc')->get();
        return $clients;
    }

//https://github.com/mindscms/laravael-excel/blob/master/app/Exports/ProductsExport.php ->take(100)
    public function map($clients): array
    {
         return [
             $clients->meta->nbdossier,
             $clients->meta->date_j,
             $clients->name,
             $clients->meta->manager,
             $clients->phone,
             $clients->email,
             $clients->meta->adress,
             $clients->meta->ville,
             $clients->meta->website,
             $clients->meta->agrement_number,
             $clients->meta->rc,
             $clients->meta->ice,
             $clients->meta->remarques,

         ];
    }

    public function headings(): array
    {
        return [
            'N° Dossier',
            'Date',
            'Entreprise',
            'Gérant',
            'Téléphone',
            'E-mail',
            'Adresse',
            'Ville',
            'Site web',
            'N° d\'agrément',
            'N° RC',
            'N° ICE',
            'Remarques'
        ];
    }
}

Zerion Mini Shell 1.0