Skip to content

Commit

Permalink
Merge pull request #2 from Muetze42/main
Browse files Browse the repository at this point in the history
Automatic hide on forms
  • Loading branch information
Flatroy authored May 1, 2022
2 parents 0f6daf0 + 510bbfa commit d7d2534
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ public function fields(NovaRequest $request)
->min(0.01)
->max(1)
->step(0.01)
->hideFromIndex()
->hideFromDetail(),
->onlyOnForms(),

FieldProgressbar::make(__('Score'), 'score')
->hideWhenUpdating()
->hideWhenCreating()
->sortable(),
];
}
Expand Down
14 changes: 14 additions & 0 deletions src/FieldProgressbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@

class FieldProgressbar extends Field
{
/**
* Indicates if the element should be shown on the update view.
*
* @var (callable(\Laravel\Nova\Http\Requests\NovaRequest, mixed):bool)|bool
*/
public $showOnUpdate = false;

/**
* Indicates if the element should be shown on the creation view.
*
* @var (callable(\Laravel\Nova\Http\Requests\NovaRequest):bool)|bool
*/
public $showOnCreation = true;

/**
* The field's component.
*
Expand Down

0 comments on commit d7d2534

Please sign in to comment.