app/Http/Controllers/Seller/SellerBuyerController.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 $seller)
    {
        $buyers = $seller->products()
            ->whereHas('transactions')
            ->with('transactions.user')
            ->get()
            ->pluck('transactions')
            ->collapse()
            ->pluck('user')
            ->unique()
            ->values();
        return $this->showAll(new UserCollection($buyers));
    }
public function index ( User $ seller ) { $ buyers = $ seller -> products ( ) -> whereHas ( 'transactions' ) -> with ( 'transactions.user' ) -> get ( ) -> pluck ( 'transactions' ) -> collapse ( ) -> pluck ( 'user' ) -> unique ( ) -> values ( ) ; return $ this -> showAll ( new UserCollection ( $ buyers ) ) ; }
Display a listing of the resource.
Display a listing of the resource .