File manager - Edit - /var/www/payraty/hris/app/Exports/EventExport.php
Back
<?php namespace App\Exports; use App\Models\Event; use App\Models\Branch; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; class EventExport implements FromCollection, WithHeadings { /** * @return \Illuminate\Support\Collection */ public function collection() { $data = Event::where('created_by', \Auth::user()->creatorId())->get(); foreach ($data as $k => $events) { $data[$k]["branch_id"] = Branch::where('id',$events->branch_id)->pluck('name')->first(); } return $data; } public function headings(): array { return [ "ID", "Branch Id", "Department Id", "Employee Id", "Title", "Start Date", "End Date", "Color", "Description", "Created By", "Created At", "Updated At", ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0.29 |
proxy
|
phpinfo
|
Settings