From 3e684fbd81162d6e3a59aaf36b5d66eaebe11b7d Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Fri, 3 Nov 2023 08:27:53 -0400 Subject: [PATCH] - Now allowing privilege from enums --- composer.json | 2 +- src/Taxus.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 95d2671..5772287 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "authors": [ { "name": "Dave Mc Nicoll", - "email": "dave.mcnicoll@cslsj.qc.ca" + "email": "info@mcnd.ca" } ], "autoload": { diff --git a/src/Taxus.php b/src/Taxus.php index 6e114fb..068f001 100644 --- a/src/Taxus.php +++ b/src/Taxus.php @@ -34,6 +34,8 @@ class Taxus public function granted($name, ...$arguments) : bool { + $name = $name instanceof \BackedEnum ? $name->value : $name; + if ( ! isset($this->list[$name]) ) { throw new \InvalidArgumentException("Privilege '{$name}' could not be found. Did you forgot to add it to your Taxus object ?"); }