Skip to content

Commit

Permalink
Merge pull request #8 from discoverydesign/feat-4
Browse files Browse the repository at this point in the history
Feature - `->hideOnCreate()` helper function
  • Loading branch information
discoveryjames authored Aug 22, 2024
2 parents 578a57d + 1e7a342 commit a59ce97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ GazeBanner::make()
GazeBanner::make()
->hidden(fn (?Order $record) => $record === null),
```
There is also a helper function
```php
GazeBanner::make()
->hideOnCreate(),
```


## Docs
Expand Down Expand Up @@ -126,6 +131,11 @@ GazeBanner::make()
#### Arguments
`fnc` - (optional, closure | bool) If the user can take control of the resource. Default is true. If a closure is passed, it should return a bool.

### `->hideOnCreate()`

#### Description
`hideOnCreate` is a helper function that can be used to hide the banner on create forms.


## Author

Expand Down
11 changes: 11 additions & 0 deletions src/Forms/Components/GazeBanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ function () {
return $this;
}

/*
* Helper function to hide on create
*/

public function hideOnCreate(): static
{
$this->hidden(fn ($record) => $record === null);

return $this;
}

/**
* Set the take control state
*/
Expand Down

0 comments on commit a59ce97

Please sign in to comment.