diff --git a/src/Illuminate/Database/Grammar.php b/src/Illuminate/Database/Grammar.php index 5dbe5c074c96..798ac3ee1098 100755 --- a/src/Illuminate/Database/Grammar.php +++ b/src/Illuminate/Database/Grammar.php @@ -138,29 +138,29 @@ public function parameterize(array $values) } /** - * Quote string literals. + * Get the appropriate query parameter place-holder for a value. * - * @param string|array $value + * @param mixed $value * @return string */ - public function quote($value) + public function parameter($value) { - if (is_array($value)) { - return implode(', ', array_map([$this, 'quote'], $value)); - } - - return "'$value'"; + return $this->isExpression($value) ? $this->getValue($value) : '?'; } /** - * Get the appropriate query parameter place-holder for a value. + * Quote the given string literal. * - * @param mixed $value + * @param string|array $value * @return string */ - public function parameter($value) + public function quoteString($value) { - return $this->isExpression($value) ? $this->getValue($value) : '?'; + if (is_array($value)) { + return implode(', ', array_map([$this, __FUNCTION__], $value)); + } + + return "'$value'"; } /** diff --git a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php index 215cec2475e6..2cc2ee229cb8 100755 --- a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -549,7 +549,7 @@ protected function typeBoolean(Fluent $column) */ protected function typeEnum(Fluent $column) { - return sprintf('enum(%s)', $this->quote($column->allowed)); + return sprintf('enum(%s)', $this->quoteString($column->allowed)); } /** diff --git a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php index ac06d0bbe3f3..67fae25045a3 100755 --- a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php @@ -522,7 +522,7 @@ protected function typeEnum(Fluent $column) return sprintf( 'varchar(255) check ("%s" in (%s))', $column->name, - $this->quote($column->allowed) + $this->quoteString($column->allowed) ); } diff --git a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index 577978c5318a..be6d7c5f5276 100755 --- a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -512,7 +512,7 @@ protected function typeEnum(Fluent $column) return sprintf( 'varchar check ("%s" in (%s))', $column->name, - $this->quote($column->allowed) + $this->quoteString($column->allowed) ); } diff --git a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php index 645bd32472d5..959ccde3e10f 100755 --- a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -455,7 +455,7 @@ protected function typeEnum(Fluent $column) return sprintf( 'nvarchar(255) check ("%s" in (%s))', $column->name, - $this->quote($column->allowed) + $this->quoteString($column->allowed) ); }