4 months ago

Get values from relation in collection after get()

Posted 4 months ago by AdRock

I call a model with a relationship like this

$tickets = Ticket::with('type')->get();

How can I get the distinct rows from the relation?

Each $ticket will have a relation called type in there are fields for id and type.

I could do another DB query to get this information but if I can get it from the collection I'd rather do that

Please sign in or create an account to participate in this conversation.