diff --git a/README.md b/README.md index ba790a0..16d3f5e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/BreezyCore.php b/src/BreezyCore.php index bafc332..917f71b 100644 --- a/src/BreezyCore.php +++ b/src/BreezyCore.php @@ -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; @@ -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; }