<?php

namespace App\Http\Controllers\FrontEnd;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Item;
use DB;
use Auth;
use App\ItemModel;
use App\AccessoriesModel;
use App\FundsRegisterModel;
use Illuminate\Support\Facades\Crypt;
class ItemListController extends Controller
{
    public function ajaxPagination(Request $request)
    {
        $data = Item::paginate(15);
  
        if ($request->ajax()) {
            return view('presult', compact('data'));
        }
  
        return view('ajaxPagination', compact('data'));
    }
}

        // $items = DB::select("SELECT concat(province.province_en,', ' ,commune.commune_en,', ' ,district.district_en,', ' ,village.village_en) as address,
        // nso007_item_stock.id,
        // nso007_item_stock.item_title,
        // nso007_item_stock.item_bedroom,
        // nso007_item_stock.item_bathroom,
        // nso007_item_stock.item_floor,
        // nso007_item_stock.item_sq_fp,
        // nso007_item_stock.item_parking,
        // nso007_item_stock.item_size,nso007_item_stock.item_img,nso007_item_stock.item_name,nso007_item_stock.item_des,nso007_item_stock.item_price,nso007_item_stock.item_size,nso007_item_stock.item_cost,nso007_item_stock.created_at,nso007_category_stock.category_name,nso007_project_stock.project_name FROM `nso007_item_stock` 
        // INNER JOIN nso007_project_stock ON nso007_project_stock.id = nso007_item_stock.item_projectid
        // INNER JOIN nso007_category_stock ON nso007_category_stock.id = nso007_item_stock.item_categoryid
        // INNER JOIN province ON province.province_id = nso007_project_stock.p_province
        // INNER JOIN district ON district.district_id = nso007_project_stock.p_district
        // INNER JOIN commune ON commune.commune_id = nso007_project_stock.p_commune
        // INNER JOIN village ON village.village_id = nso007_project_stock.p_village

        // where  nso007_item_stock.item_salestatus = 0 
        // and  nso007_item_stock.available = 1
        // and nso007_item_stock.item_projectid  = $decrypt_id
        // GROUP BY nso007_item_stock.id,province.province_en,commune.commune_en,district.district_en,village.village_en
        // order By  nso007_item_stock.id ASC
        
       
        
        // ");