You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Add a `position` (can be custom) column in your table (model)
31
32
2. Add `PositionTrait` into your model (if you are using custom column set the `$positionColumn` property)
32
33
3. If you are using grouped entries (like parent_id and etc), you can set the `$positionGroup` with the column name/names (supports single string or multiple columns)
33
-
4. Add to form the position input (can be input[type=number] and etc) and fill/set the position
34
-
5. When position is null or empty string, the last position will be used
34
+
4. Add to form the position input (can be input[type=number] and etc) and fill/set the position on save
35
+
5. When position is null or empty string, the last position will be used.
35
36
36
37
**Then you can get your entries sorted:**
37
38
@@ -48,6 +49,39 @@ If using default column name (position), the value will be converted to numeric
48
49
**Get the position**
49
50
Use the `$model->getPosition()` or use the standard way by using the column name `$model->position`
50
51
52
+
### Migration example
53
+
54
+
```php
55
+
public function up()
56
+
{
57
+
Schema::table('pages', function (Blueprint $table) {
0 commit comments