protected function forCategories() : array
	{
		$categories = $this->products->pluck('category');

		return $categories->mapWithKeys(function ($item) use ($categories) {

				$result[$item->id] = [
					'id' => $item->id,
					'name' => $item->name,
					'qty' => $categories->where('id', $item->id)->count()
				];

				return $result;
		})->all();
	}
protected function forCategories() : array
	{
		$categories = $this->products->pluck('category');

		return $categories->mapWithKeys(function ($item) use ($categories) {

				$result[$item->id] = [
					'id' => $item->id,
					'name' => $item->name,
					'qty' => $categories->where('id', $item->id)->count()
				];

				return $result;
		})->all();
	}
protected function forCategories ( ) : array { $ categories = $ this -> products -> pluck ( 'category' ) ; return $ categories -> mapWithKeys ( function ( $ item ) use ( $ categories ) { $ result [ $ item -> id ] = [ 'id' => $ item -> id , 'name' => $ item -> name , 'qty' => $ categories -> where ( 'id' , $ item -> id ) -> count ( ) ] ; return $ result ; } ) -> all ( ) ; }
Parses the category filter.

@return array
Parses the category filter .