Skip to content

Commit

Permalink
Use trait instead of abstract class. (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobeycodes authored and shabbirbharmal committed Nov 6, 2018
1 parent ae83f6d commit a6251f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ composer require arsenaltech/nova-tab

## Usage

Extend App\Nova\Resource from Arsenaltech\NovaTab\Resource
Add the Tabs trait to your App\Nova\Resource class.

```php
use Arsenaltech\NovaTab\Resource as TabResource;
use Arsenaltech\NovaTab\Tabs;

abstract class Resource extends TabResource
abstract class Resource extends NovaResource
{
use Tabs;
```

Add the field to your resource in the `fields` method:
Expand Down
5 changes: 1 addition & 4 deletions src/Resource.php → src/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Laravel\Nova\Resource as NovaResource;
use Laravel\Nova\Http\Requests\NovaRequest;

abstract class Resource extends NovaResource
trait Tabs
{


public function updateFields(NovaRequest $request) {
$updateFields = parent::updateFields($request);
if(!$request->isMethod('get')) {
Expand Down Expand Up @@ -87,5 +85,4 @@ protected function assignFieldsToTabs(NovaRequest $request, $fields)

return $fields;
}

}

0 comments on commit a6251f8

Please sign in to comment.