KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
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/peoplebee.in/___accounts-admin/app/Exports/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/peoplebee.in/___accounts-admin/app/Exports/EmployeeExport.php
<?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
};
use App\Models\HRMS\Employee;

class EmployeeExport implements FromCollection, WithHeadings
{
	/**
	 * @return \Illuminate\Support\Collection
	 */
    private $admin_id,$department_id,$branch_id,$start_date,$end_date;

    public function __construct($admin_id)
    {
        $this->admin_id = $admin_id;
    }
    
	public function collection()
	{
        
        $this->department_id = isset($_GET["department"]) ? $_GET["department"] : null;
        $this->branch_id = isset($_GET["branch_id"]) ? $_GET["branch_id"] : null;
        $this->start_date = isset($_GET["start_date"]) ? $_GET["start_date"] : null;
        $this->end_date = isset($_GET["end_date"]) ? $_GET["end_date"] : null;
        
        //return $admin_id;
		$query = Employee::where("employees.admin_id","=",$this->admin_id)
        ->leftJoin('employee_departments','employee_departments.id','=','employees.department')
        ->leftJoin('schools','schools.id','=','employees.branch_id')
        ->leftJoin('users','users.user_unique_id','=','employees.user_unique_id');
        //$query->where('type','=','user');

        if($this->department_id)
        {
            $query->where('employees.department',$this->department_id);
        }
        if($this->branch_id)
        {
            $query->where('employees.branch_id',$this->branch_id);
        }
        if($this->start_date && $this->end_date)
        {
         
            $query->where('employees.created_at', '>=', $this->start_date)
            ->where('employees.created_at', '<=', $this->end_date); 
        
        }

        
        
		
		
		return $query->select(  
                "schools.school",
                "employees.name as employee_name",
                "employee_departments.name as department_name",
                "employees.designation",
                "employees.mobile",
                "employees.email",
                "employees.dob",
                "employees.doj",
                "employees.pan_number",
                "employees.created_at"
            )->orderBy('employees.created_at', 'DESC')->get();
           
        
	}

	public function headings(): array
	{
		return [
            "Branch Name",
            "Employee Name",
            "Department",
            "Designation",
            "Mobile",
            "Email",
            "Date Of Birth",
            "Date Of Joining",
            "PAN Number",
            "Created Date"
		];
	}
}

Anon7 - 2021