diff --git a/src/Schema/BuilderView.php b/src/Schema/BuilderView.php index 87a22e3..be8ef06 100644 --- a/src/Schema/BuilderView.php +++ b/src/Schema/BuilderView.php @@ -12,10 +12,10 @@ trait BuilderView /** * Create a materialized view on the schema. */ - public function createMaterializedView(string $name, QueryBuilder|string $query, bool $withData = true, array $columns = null): void + public function createMaterializedView(string $name, QueryBuilder|string $query, bool $withData = true, array $columns = []): void { $name = $this->getConnection()->getSchemaGrammar()->wrapTable($name); - if (null !== $columns) { + if (filled($columns)) { $columns = $this->getConnection()->getSchemaGrammar()->columnize($columns); $name = "{$name} ({$columns})"; } @@ -49,10 +49,10 @@ public function createRecursiveViewOrReplace(string $name, QueryBuilder|string $ /** * Create a view on the schema. */ - public function createView(string $name, QueryBuilder|string $query, array $columns = null): void + public function createView(string $name, QueryBuilder|string $query, array $columns = []): void { $name = $this->getConnection()->getSchemaGrammar()->wrapTable($name); - if (null !== $columns) { + if (filled($columns)) { $columns = $this->getConnection()->getSchemaGrammar()->columnize($columns); $name = "{$name} ({$columns})"; } @@ -63,10 +63,10 @@ public function createView(string $name, QueryBuilder|string $query, array $colu /** * Create or replace a view on the schema. */ - public function createViewOrReplace(string $name, QueryBuilder|string $query, array $columns = null): void + public function createViewOrReplace(string $name, QueryBuilder|string $query, array $columns = []): void { $name = $this->getConnection()->getSchemaGrammar()->wrapTable($name); - if (null !== $columns) { + if (filled($columns)) { $columns = $this->getConnection()->getSchemaGrammar()->columnize($columns); $name = "{$name} ({$columns})"; } diff --git a/src/Support/Facades/Schema.php b/src/Support/Facades/Schema.php index a97038e..7872b69 100755 --- a/src/Support/Facades/Schema.php +++ b/src/Support/Facades/Schema.php @@ -18,9 +18,9 @@ * @method static void createFunctionOrReplace(string $name, array $parameters, array|string $return, string $language, string $body, array $options = []) * @method static void createRecursiveView(string $name, Builder|string $query, array $columns) * @method static void createRecursiveViewOrReplace(string $name, Builder|string $query, array $columns) - * @method static void createMaterializedView(string $name, Builder|string $query, bool $withData = true, array $columns = null) - * @method static void createView(string $name, Builder|string $query, array $columns = null) - * @method static void createViewOrReplace(string $name, Builder|string $query, array $columns = null) + * @method static void createMaterializedView(string $name, Builder|string $query, bool $withData = true, array $columns = []) + * @method static void createView(string $name, Builder|string $query, array $columns = []) + * @method static void createViewOrReplace(string $name, Builder|string $query, array $columns = []) * @method static void dropExtension(string ...$name) * @method static void dropExtensionIfExists(string ...$name) * @method static void dropFunction(string $name, ?array $arguments = null)