app/Http/Controllers/Buyer/BuyerCategoryController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(User $buyer)
    {
        $categories = $buyer->transactions()->with('product.categories')
                    ->get()
                    ->pluck('product.categories')
                    ->collapse()
                    ->unique('id')
                    ->values();
        return $this->showAll(new CategoryCollection($categories));
    }
public function index ( User $ buyer ) { $ categories = $ buyer -> transactions ( ) -> with ( 'product.categories' ) -> get ( ) -> pluck ( 'product.categories' ) -> collapse ( ) -> unique ( 'id' ) -> values ( ) ; return $ this -> showAll ( new CategoryCollection ( $ categories ) ) ; }
Display a listing of the resource.
Display a listing of the resource .