<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\AdminController;

use Illuminate\Http\Request;
use App\Members;
use Carbon\Carbon;
use DB;
use App\Services\Country;
use App\Helpers\Helper;
use App\Hotel;
use App\Tour;
use App\Post;
use App\Packages;

use App\Customers;
class DashboardController extends AdminController {

    private $from;
    private $to;

    public function __construct() {
        $this->middleware('auth');
        $this->from = date("Y-m-d", strtotime("-1 month"));
        $this->to = date("Y-m-d");
    }

    public function index() {

        $range["from"] = $this->from;
        $range["to"] = $this->to;
        $data = $range;
//        $tours= Tour::where('status',1)->get();
//        $data["tours"]=$tours->count();
//        $hotels= Hotel::where('status',1)->get();
//        $data["hotels"]=$hotels->count();
//        $news= Post::where('status',1)->get();
        $data["posts"]= Post::where('status',1)->count();
        $data["packages"]= Packages::where('status',1)->count();
        $data["customers"]= Customers::where('status',1)->count();
        return view('admin/dashboard/index', $data);
    }
    
}