Esempio n. 1
0
 public function search()
 {
     $brands = $this->brands;
     $socho = $this->sochoxe;
     //dd($brands); die();
     $tintucs = $this->tintucs;
     $q = Input::get('q');
     $cars = Cars::where('ten_xe', 'LIKE', '%' . $q . '%')->orWhere('socho_xe', 'LIKE', '%' . $q . '%')->orWhere(function ($query) use($q) {
         $brands = Brand::where('hang_name', 'LIKE', '%' . $q . '%')->get()->toArray();
         //dd($brand);
         $hang_id = array();
         foreach ($brands as $key => $value) {
             array_push($hang_id, $value['hang_id']);
         }
         $query->whereIn('hang_id', $hang_id);
     })->get();
     return view('frontend.pages.searchresult', compact('cars', 'q', 'brands', 'socho', 'tintucs'));
 }
Esempio n. 2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $brandDetails = Brand::where('id', $id)->with('products')->first();
     return view('brand')->with('brandDetails', $brandDetails);
 }