<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

use App\Product;
use App\Brand;

class DropdownController extends Controller
{

    public function index()
    {
        $motors = Product::where('id_sku', '<', 500)->get();
        //$merks = Brand::pluck('brd_name','id_brd');
		$merks	= Brand::all();
        return view('dropdown.index' ,compact('motors','merks'));
    }

    public function merkAjax($id){
        if($id==0){
            $motors = Product::all();
        }else{
            $motors = Product::where('brd_id','=',$id)->get();
        }
        return $motors;
    }

}
