umbrellio / laravel-pg-extensions

Laravel extensions for Postgres
MIT License
90 stars 18 forks source link

Declaration of `Umbrellio\Postgres\Schema\Builder::hasView(string $view): bool` must be compatible with `Illuminate\Database\Schema\Builder::hasView($view)` #81

Closed mpyw closed 6 months ago

mpyw commented 7 months ago
    /**
     * Determine if the given view exists.
     *
     * @param  string  $view
     * @return bool
     */
    public function hasView($view)
    {
        $view = $this->connection->getTablePrefix().$view;

        foreach ($this->getViews() as $value) {
            if (strtolower($view) === strtolower($value['name'])) {
                return true;
            }
        }

        return false;
    }
    public function hasView(string $view): bool
    {
        return count($this->connection->selectFromWriteConnection($this->grammar->compileViewExists(), [
            $this->connection->getConfig()['schema'],
            $this->connection->getTablePrefix() . $view,
        ])) > 0;
    }