Skip to content

Commit

Permalink
Merge pull request #306 from caendesilva/patch-2
Browse files Browse the repository at this point in the history
Add feature to ignore MyProfile components
  • Loading branch information
jeffgreco13 authored Dec 28, 2023
2 parents 5630be2 + 15dbd4c commit 76998f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ BreezyCore::make()
)

```

#### Exclude default My Profile components

If you don't want a default My Profile page component to be used, you can exclude them using the `withoutMyProfileComponents` helper.

```php
BreezyCore::make()
->withoutMyProfileComponents([
'update_password'
])
```


#### Create custom My Profile components

In Breezy v2, you can now create custom Livewire components for the My Profile page and append them easily.
Expand Down
11 changes: 9 additions & 2 deletions src/BreezyCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class BreezyCore implements Plugin
protected $twoFactorAuthentication;
protected $forceTwoFactorAuthentication;
protected $twoFactorRouteAction;
protected $ignoredMyProfileComponents = [];
protected $registeredMyProfileComponents = [];
protected $passwordUpdateRules = ['min:8'];
protected bool $passwordUpdateRequireCurrent = true;
Expand Down Expand Up @@ -159,12 +160,18 @@ public function getAvatarUploadComponent()
]);
}

public function withoutMyProfileComponents(array $components)
{
$this->ignoredMyProfileComponents = $components;
return $this;
}

public function myProfileComponents(array $components)
{
$this->registeredMyProfileComponents = [
$this->registeredMyProfileComponents = Arr::except([
...$components,
...$this->registeredMyProfileComponents,
];
], $this->ignoredMyProfileComponents);

return $this;
}
Expand Down

0 comments on commit 76998f5

Please sign in to comment.