-
-
Notifications
You must be signed in to change notification settings - Fork 142
Closed
Description
I'm trying to use this package on a MorphPivot model, but it's not working, no errors while debugging, it just does not generate the sort/order values. Am I missing something?
Here is the model:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\MorphPivot;
use Spatie\EloquentSortable\Sortable;
use Spatie\EloquentSortable\SortableTrait;
class Groupables extends MorphPivot implements Sortable
{
use SortableTrait;
public $sortable = [
'order_column_name' => 'sort',
'sort_when_creating' => true,
];
public function buildSortQuery()
{
return static::query()
->where('group_id', $this->group_id)
->where('groupable_type', $this->groupable_type);
}
}
Metadata
Metadata
Assignees
Labels
No labels