generated from filamentphp/plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from bezhanSalleh/feature/deprecate-excludes
Feature/deprecate excludes
- Loading branch information
Showing
4 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BezhanSalleh\PanelSwitch\Concerns; | ||
|
||
use Filament\Facades\Filament; | ||
use InvalidArgumentException; | ||
|
||
trait HasPanelValidator | ||
{ | ||
/** | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function areUserProvidedPanelsValid(array $panelIds): void | ||
{ | ||
$validated = collect($panelIds)->diff(collect(Filament::getPanels())->keys()->toArray()); | ||
|
||
if ($validated->isNotEmpty()) { | ||
throw new InvalidArgumentException("Invalid Filament Panel. Make sure the panel ids passed to the `Panel Switch`, are valid and do exist. [`{$validated->implode(', ')}`]"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters