app/User.php
/**
     * Check if the user has the role passed as parameter and it is active
     *
     *
     * @param string $role
     * @return bool
     */
Check if the user has the role passed as parameter and it is active
@param string $role
@return bool
Check if the user has the role passed as parameter and it is active @param string $role @return bool
public function hasRole($role){
        $A_role = explode('|',$role);
        if( is_array($A_role) ) {
            if ( in_array( $this->role->name, $A_role ) && $this->is_active == 1 ) {
                return true;
            }
        }
        return false;
    }
public function hasRole ( $ role ) { $ A_role = explode ( '|' , $ role ) ; if ( is_array ( $ A_role ) ) { if ( in_array ( $ this -> role -> name , $ A_role ) && $ this -> is_active == 1 ) { return true ; } } return false ; }
Check if the user has the role passed as parameter and it is active
 @param string $role
 @return bool
Check if the user has the role passed as parameter and it is active @param string $role @return bool
// Change $role to Array. So we can have ['admin','author'])