|
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 UserExport implements FromCollection, WithHeadings
{
/**
* @return \Illuminate\Support\Collection
*/
private $admin_id;
public function __construct($adminId)
{
$this->admin_id = $adminId;
}
public function collection()
{
//return $admin_id;
$query = User::where([['type','=','user'],["admin_id","=",$this->admin_id]])->orderBy('created_at', 'DESC');
//$query->where('type','=','user');
return $query->get(
[
"id",
"admin_id",
"name",
"email",
"mobile",
"gender",
"address",
"city",
"state",
"pincode",
"country",
"created_at"
]);
}
public function headings(): array
{
return [
"id",
"admin_id",
"name",
"email",
"mobile",
"gender",
"address",
"city",
"state",
"pincode",
"country",
"created_at"
];
}
}