- Now allowing privilege from enums
This commit is contained in:
		
							parent
							
								
									c5a42a9093
								
							
						
					
					
						commit
						3e684fbd81
					
				@ -6,7 +6,7 @@
 | 
			
		||||
  "authors": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "Dave Mc Nicoll",
 | 
			
		||||
      "email": "dave.mcnicoll@cslsj.qc.ca"
 | 
			
		||||
      "email": "info@mcnd.ca"
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "autoload": {
 | 
			
		||||
 | 
			
		||||
@ -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 ?");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user