5 months ago

Returning the distinct results of Polymorphic relationship

Posted 5 months ago by GM

I'm trying out spatie/laravel-model-status which creates a polymorphic relationship between your models and the status table.

For example a post might be in one of a series of states ( "new","editing","publishing"). I want to create a distinct list of the various statuses of the posts where the status has changed between two dates and I am little stumped.

How do you perform a distinct on the collection results of a polymorphic relationship?

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