Open johnpaulmedina opened 6 years ago
Added this to future plans. In the meantime you're more than welcome to make a PR.
@johnpaulmedina We can make this work with HasMany
and MorphMany
relationships already.
To make sure that sorting is done among groups only, we can override buildSortQuery()
method on the model.
/**
* Build eloquent builder of sortable. (For spatie/eloquent-sortable package)
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function buildSortQuery()
{
return static::query()->where('post_id', $this->post_id);
}
@gauravmak do you mean you have the UI (the arrows) showing up in the HasMany
grouping?
If so, how? Thanks!
@timbroder Yes, that was the case as far as I can remember. I was displaying only the records of a group and then sorting had to work among the group records only.
I was writing something to extend the default sort when I came across someone linking to your package. I noticed that you are only attaching the sort on the index and it is not able to sort on the related content.
Any plans on doing this or should I write my own?