Skip to content

Commit 39ebb1c

Browse files
committed
Updated resources to add sorting fields
1 parent 040119c commit 39ebb1c

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

tests/Resource/EmployeeHasMany.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public function fields(Request $request)
2121
return [
2222
Text::make('Name'),
2323

24-
HasMany::make('Bills', 'bills', Bill::class)->inline(),
24+
HasMany::make('Bills', 'bills', Bill::class)
25+
->inline()
26+
->sortUsing('weight'),
2527
];
2628
}
2729
}

tests/Resource/EmployeeMorphMany.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Laravel\Nova\Resource;
66
use Illuminate\Http\Request;
77
use Laravel\Nova\Fields\Text;
8-
use Laravel\Nova\Fields\MorphOne;
8+
use Laravel\Nova\Fields\MorphMany;
99

1010
class EmployeeMorphMany extends Resource
1111
{
@@ -21,7 +21,9 @@ public function fields(Request $request)
2121
return [
2222
Text::make('Name'),
2323

24-
MorphOne::make('Comments', 'comments', Comment::class)->inline(),
24+
MorphMany::make('Comments', 'comments', Comment::class)
25+
->inline()
26+
->sortUsing('weight'),
2527
];
2628
}
2729
}

0 commit comments

Comments
 (0)