public function scopeBrand($query, $id)
 {
     $brands = Brand::lists('name', 'id');
     if ($id != "" && isset($brands[$id])) {
         $query->where('brand_id', $id);
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $category = $this->categories->findOrFail($id);
     $items = $this->categories->lists('name', 'id')->toarray();
     return \View::make('admin.categories.update', compact('category', 'items'));
 }