public function getAcquaintances()
    {
        $acquaintances = new Collection();

        // Past message senders
        foreach ($this->messages()->received()->with('sender')->get() as $message) {
            $acquaintances = $acquaintances->push($message->sender);
        }

        // Past message recipients
        foreach ($this->messages()->sent()->with('recipient')->get() as $message) {
            $acquaintances = $acquaintances->push($message->recipient);
        }

        // Past sellers
        foreach ($this->purchases()->with('item.seller')->get() as $purchase) {
            $acquaintances = $acquaintances->push($purchase->item->seller);
        }

        // Past buyers
        foreach ($this->items()->with('purchases.buyer')->get() as $item) {
            foreach ($item->purchases as $purchase) {
                $acquaintances = $acquaintances->push($purchase->buyer);
            }
        }

        return $acquaintances->unique();
    }
public function getAcquaintances()
    {
        $acquaintances = new Collection();

        // Past message senders
        foreach ($this->messages()->received()->with('sender')->get() as $message) {
            $acquaintances = $acquaintances->push($message->sender);
        }

        // Past message recipients
        foreach ($this->messages()->sent()->with('recipient')->get() as $message) {
            $acquaintances = $acquaintances->push($message->recipient);
        }

        // Past sellers
        foreach ($this->purchases()->with('item.seller')->get() as $purchase) {
            $acquaintances = $acquaintances->push($purchase->item->seller);
        }

        // Past buyers
        foreach ($this->items()->with('purchases.buyer')->get() as $item) {
            foreach ($item->purchases as $purchase) {
                $acquaintances = $acquaintances->push($purchase->buyer);
            }
        }

        return $acquaintances->unique();
    }
public function getAcquaintances ( ) { $ acquaintances = new Collection ( ) ; // Past message senders foreach ( $ this -> messages ( ) -> received ( ) -> with ( 'sender' ) -> get ( ) as $ message ) { $ acquaintances = $ acquaintances -> push ( $ message -> sender ) ; } // Past message recipients foreach ( $ this -> messages ( ) -> sent ( ) -> with ( 'recipient' ) -> get ( ) as $ message ) { $ acquaintances = $ acquaintances -> push ( $ message -> recipient ) ; } // Past sellers foreach ( $ this -> purchases ( ) -> with ( 'item.seller' ) -> get ( ) as $ purchase ) { $ acquaintances = $ acquaintances -> push ( $ purchase -> item -> seller ) ; } // Past buyers foreach ( $ this -> items ( ) -> with ( 'purchases.buyer' ) -> get ( ) as $ item ) { foreach ( $ item -> purchases as $ purchase ) { $ acquaintances = $ acquaintances -> push ( $ purchase -> buyer ) ; } } return $ acquaintances -> unique ( ) ; }
Get users the user has a substantial connection with.

@return \Illuminate\Support\Collection
Get users the user has a substantial connection with .