⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
cms.dev-unit.com
/
core
/
app
/
Exports
/
View File Name :
EnrolmentsExport.php
<?php namespace App\Exports; use App\Models\BasicSettings\Basic; use App\Models\Language; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\WithMapping; class EnrolmentsExport implements FromCollection, WithHeadings, WithMapping { public $enrols; public function __construct($enrols) { $this->enrols = $enrols; } /** * @return \Illuminate\Support\Collection */ public function collection() { return $this->enrols; } public function map($enrol): array { $bs = Basic::firstOrFail(); $deLang = Language::where('is_default', 1)->first(); return [ $enrol->order_id, $enrol->course->information()->where('language_id', $deLang->id)->pluck('title')->first(), ($bs->base_currency_symbol_position == 'left' ? $bs->base_currency_symbol : '') . $enrol->course_price . ($bs->base_currency_symbol_position == 'right' ? $bs->base_currency_symbol : ''), ($bs->base_currency_symbol_position == 'left' ? $bs->base_currency_symbol : '') . (empty($enrol->discount) ? 0 : $enrol->discount) . ($bs->base_currency_symbol_position == 'right' ? $bs->base_currency_symbol : ''), ($bs->base_currency_symbol_position == 'left' ? $bs->base_currency_symbol : '') . $enrol->grand_total . ($bs->base_currency_symbol_position == 'right' ? $bs->base_currency_symbol : ''), $enrol->billing_first_name, $enrol->billing_email, $enrol->billing_contact_number, $enrol->billing_city, $enrol->billing_state, $enrol->billing_country, $enrol->payment_method, $enrol->payment_status, $enrol->created_at ]; } public function headings(): array { return [ 'Order Number', 'Course', 'Course Price', 'Discount', 'Total', 'Name', 'Email', 'Phone', 'City', 'State', 'Country', 'Gateway', 'Payment Status', 'Date' ]; } }