<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

use App\Http\Controllers\AdminController;
use App\Enquiry;
use App\Tour;
use App\Hotel;
class EnquiryController extends AdminController
{
     public function __construct() {
        $this->middleware('auth');
        $this->breadcrumbs = $this->getBreadcrumbs();
        $this->breadcrumbs[1]['link'] = "admin/enquire";
        $this->breadcrumbs[1]['name'] = " Enquire";
    }
    
    public function index() {
        $enquire = Enquiry::get();
        $data["pageHeader"] = false;
        $data["model"] = $enquire;
        $data["title"] = "Enquire";
        $data["SubTitle"] = "List";
        $data['breadcrumbs'] = $this->breadcrumbs;
        return view('admin/enquire/index', $data);
    }
    
    public function delete($id) {


        Enquiry::where('id', $id)->delete();
        \Session::flash('error', 'Enquire updated successfully!');
        return redirect('admin/enquire');
    }
    public function show($id) {
          
        $q = new Enquiry();
        $enquire=$q->find($id);
        $data['model'] =$enquire;
//        if($enquire->type=="tour"){
//            $data['detail']=Tour::where('id',$enquire->type_id)->first();  
//        }
//        if($enquire->type=="hotel"){
//            $data['detail']= Hotel::where('id',$enquire->type_id)->first();  
//        }
      
        $data["title"] = "Enquire";
        $this->breadcrumbs[2]['link'] = "#_";
        $this->breadcrumbs[2]['name'] = "View";
        $data['breadcrumbs'] = $this->breadcrumbs;


       return view('admin/enquire/show', $data);
    }
}
