lundi 12 novembre 2018

Laravel Eloquent Builder

I want to convert the following code from a collection to a builder

return $buyer->transactions()->with('product.pt')
        ->get()
        ->pluck('product.pt')
        ->unique('id')
        ->values();

And the run ->get(); on the returned builder to get a collection of pt

The closest I can do is return $buyer->transactions()->with('product.pt') but running ->get(); on this will give me a collection of transactions with relations to pt



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire