<?php

namespace App\Http\Controllers\SyS;


use App\Http\Controllers\Controller;
use App\Repositories\ImportRepository;
use Request;


class ImportController extends Controller
{
    protected $userRepo;
    protected $import;

    public function __construct(ImportRepository $import)
    {
        $this->middleware('sysadmin');
        $this->import = $import;

    }


    public function import()
    {
        $data = [
        ];
        return view('sys.admin.import', $data);
    }


    public function importStore()
    {
        $input = Request::all();
        return $this->import->upload($input);
    }

    public function importShow($type, $file, $skip = 0, $limit = 4000)
    {
        $import = $this->import->read($type, $file, $skip, $limit);
        $data = [
            'limit' => $limit,
            'type' => $type,
            'file' => $file,
            'import' => $import,
            'skip' => $skip,
        ];
        return view('sys.admin.import-show', $data);

    }



}