<?php

namespace App\Exports;

use App\Models\Visitor;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use DB;
class VisitorlistExport implements FromView
{
    protected $event_id;
    protected $customer_id;
    protected $category_id;
    protected $sub_category_id;
    protected $state_id;
    protected $city_id;
    protected $is_international;
    protected $country_id;
    protected $region;
    protected $start_date;
    protected $end_date;
    // protected $id;

    function __construct($event_id,$customer_id,$category_id,$sub_category_id,$state_id,$city_id,$is_international,$country_id,$region,$start_date,$end_date) {
        $this->event_id = $event_id;
        $this->customer_id = $customer_id;
        $this->category_id = $category_id;
        $this->sub_category_id = $sub_category_id;
        $this->state_id = $state_id;
        $this->city_id = $city_id;
        $this->is_international = $is_international;
        $this->country_id = $country_id;
        $this->region = $region;
        $this->start_date = $start_date;
        $this->end_date = $end_date;
        // $this->id = $id;
    }

    public function view(): View
    {
        return view('export.exportvisitor', [
            'query' => Visitor::getvisitorByFilterExport($this->event_id,$this->customer_id,$this->category_id,$this->sub_category_id,$this->state_id,$this->city_id,$this->is_international,$this->country_id,$this->region,$this->start_date,$this->end_date)
        ]);
    }
}
