From 73de083ba851639b096ee3c888cea00962b35531 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 1 Mar 2018 11:14:14 -0500 Subject: [PATCH 1/2] Added support for MySQL's sounds-like operator --- src/Illuminate/Database/Query/Grammars/MySqlGrammar.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php index 8dff604ae6c3..8f4f81d0fcee 100755 --- a/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php @@ -9,6 +9,13 @@ class MySqlGrammar extends Grammar { + /** + * The grammar specific operators. + * + * @var array + */ + protected $operators = ['sounds like']; + /** * The components that make up a select clause. * From 8b84607ac61abbbeb3135c80851aaa3aaf03cac1 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 1 Mar 2018 14:21:17 -0500 Subject: [PATCH 2/2] Added a test --- tests/Database/DatabaseQueryBuilderTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/Database/DatabaseQueryBuilderTest.php b/tests/Database/DatabaseQueryBuilderTest.php index ac5b228302e2..49d514b6bd67 100755 --- a/tests/Database/DatabaseQueryBuilderTest.php +++ b/tests/Database/DatabaseQueryBuilderTest.php @@ -1940,6 +1940,14 @@ public function testSqlServerLimitsAndOffsets() $this->assertEquals('select * from (select *, row_number() over (order by [email] desc) as row_num from [users]) as temp_table where row_num between 11 and 20', $builder->toSql()); } + public function testMySqlSoundsLikeOperator() + { + $builder = $this->getMySqlBuilder(); + $builder->select('*')->from('users')->where('name', 'sounds like', 'John Doe'); + $this->assertEquals('select * from `users` where `name` sounds like ?', $builder->toSql()); + $this->assertEquals(['John Doe'], $builder->getBindings()); + } + public function testMergeWheresCanMergeWheresAndBindings() { $builder = $this->getBuilder();