public function setRoute(string $route = null, array $params = []): ButtonInterface
    {
        if ($this->isVisibility()) {
            if ($route === null) {
                $url = '#';
            } else {
                $url = '#';
                if (app('router')->has($route)) {
                    $url = route($route, $params);
                } else {
                    $this->setVisible(false);
                }
            }
            $this->setUrl($url);
        }

        return $this;
    }
public function setRoute(string $route = null, array $params = []): ButtonInterface
    {
        if ($this->isVisibility()) {
            if ($route === null) {
                $url = '#';
            } else {
                $url = '#';
                if (app('router')->has($route)) {
                    $url = route($route, $params);
                } else {
                    $this->setVisible(false);
                }
            }
            $this->setUrl($url);
        }

        return $this;
    }
public function setRoute ( string $ route = null , array $ params = [ ] ) : ButtonInterface { if ( $ this -> isVisibility ( ) ) { if ( $ route === null ) { $ url = '#' ; } else { $ url = '#' ; if ( app ( 'router' ) -> has ( $ route ) ) { $ url = route ( $ route , $ params ) ; } else { $ this -> setVisible ( false ) ; } } $ this -> setUrl ( $ url ) ; } return $ this ; }
If not found route, the button is not visible automatically

@param string|null $route
@param array       $params

@return ButtonInterface
If not found route the button is not visible automatically