File manager - Edit - /var/www/payraty/inventory_main/app/Exports/SuppliersExport.php
Back
<?php namespace App\Exports; use Maatwebsite\Excel\Concerns\FromArray; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\ShouldAutoSize; /** * SuppliersExport */ class SuppliersExport implements FromArray, WithHeadings, ShouldAutoSize { protected $items; /** * __construct * * @param mixed $items * @return void */ public function __construct($items) { $this->items = $items; } /** * array * * @return array */ public function array(): array { $data = []; $sl = 1; foreach ($this->items as $item) { $r = []; $r[] = $sl; $r[] = $item->first_name; $r[] = $item->last_name; $r[] = $item->email; $r[] = $item->phone; $r[] = ucwords(str_replace('_', ' ', $item->status)); $data[] = $r; $sl++; } return $data; } /** * headings * * @return array */ public function headings(): array { return [ '#', __('First Name'), __('Last Name'), __('Email'), __('Phone'), __('Status'), ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0.83 |
proxy
|
phpinfo
|
Settings