Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
michielkempen authored Sep 16, 2018
1 parent b9de7f4 commit 6f365a5
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,23 @@ composer require michielkempen/nova-order-field

### Usage

Follow the [usage instructions](https://github.com/spatie/eloquent-sortable#usage) on the eloquent-sortable repository to make your model sortable.
1. Follow the [usage instructions](https://github.com/spatie/eloquent-sortable#usage) on the eloquent-sortable repository to make your model sortable.
2. Add the `MichielKempen\NovaOrderField\Orderable` trait to your Nova Resource.
3. Add a public static property called `$defaultSortField` to your resource, containing your order column.
4. Add the `OrderField` to your Nova Resource `fields` method.

Add the `MichielKempen\NovaOrderField\Orderable` trait to your Nova Resource.
### Example

```php
use MichielKempen\NovaOrderField\Orderable;
use MichielKempen\NovaOrderField\OrderField;

class Page extends Resource
{
use Orderable;
}
```

Add a public static property called `$defaultSortField` to your resource, containing your order column.

```php
class Page extends Resource
{

public static $defaultOrderField = 'order';
}
```

Add the `OrderField` to your Nova Resource `fields` method.

```php
use \MichielKempen\NovaOrderField\OrderField;

class Page extends Resource
{

public function fields(Request $request)
{
return [
Expand Down

0 comments on commit 6f365a5

Please sign in to comment.