How to change news ranking via Laravel Admin package?

  laravel

For example, I have a code like this:

$grid = new Grid(new Movie);
$grid->id('ID')->sortable();
$grid->column('title');
$grid->created_at();
$grid->updated_at();

In this case, all records are displayed in this order:1,2,3,4,5,6,7,8,9
And I need them to be displayed in the reverse order, like this: 9,8,7,6,5,4,3,2,1

This is done by adding a new line to the code: $grid->model()->orderBy('id', 'desc');

But all this stops working if I install the extension laravel-admin grid-sortable https://github.com/laravel-admin-extensions/grid-sortable

As shown in the example, I add a new line to the code and my code looks like this:

$grid = new Grid(new Movie);
$grid->sortable();
$grid->id('ID')->sortable();
$grid->column('title');
$grid->created_at();
$grid->updated_at();

The functionality of this package works as expected, but the correct output of records in reverse order does not work, how can I fix this?

Source: Laravel

Leave a Reply