<?php

namespace App\Exports;

use App\Models\Visitor;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use DB;
class CliectVisitorlistExport 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 $action;
    protected $product;
    // 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,$action,$product) {
        $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->action = $action;
        $this->product = $product;
        // $this->id = $id;        
    }

    public function view(): View
    {
        return view('export.clientexportvisitor', [ 
            'query' => Visitor::getclientvisitorByFilterExport($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,$this->action,$this->product)
        ]);
    }
}
