Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Added support for MySQL's "sounds like" operator #23351

Merged
merged 2 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
8 changes: 8 additions & 0 deletions tests/Database/DatabaseQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down