|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/flavourapps.com/leads/leads/app/Exports/ |
Upload File : |
<?php
namespace App\Exports;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
use Illuminate\Support\Facades\Session;
use App\Models\{
User,
Company
};
class CompanyExport implements FromCollection, WithHeadings
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
$query = Company::orderBy('created_at', 'DESC');
return $query->get(
[
"admin_id",
"company_name",
"phone",
"email",
"gst_treatment",
"gstn",
"website",
"contact_person",
"company_pic",
"designation",
"contact_phone",
"contact_email",
"billing_address",
"billing_city",
"billing_state_id",
"billing_country_id",
"billing_pincode",
"location_type",
"location_address",
"location_city",
"location_state",
"location_country",
"location_pincode",
"status"]);
}
public function headings(): array
{
return [
"admin_id",
"company_name",
"phone",
"email",
"gst_treatment",
"gstn",
"website",
"contact_person",
"company_pic",
"designation",
"contact_phone",
"contact_email",
"billing_address",
"billing_city",
"billing_state_id",
"billing_country_id",
"billing_pincode",
"location_type",
"location_address",
"location_city",
"location_state",
"location_country",
"location_pincode",
"status"
];
}
}