Last active
August 29, 2015 14:06
-
-
Save chuprik/9f035bb33bf4d33ec9bf to your computer and use it in GitHub Desktop.
camelCase in where magic of the Laravel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class Base extends \Eloquent | |
{ | |
/** | |
* Get a new query builder instance for the connection. | |
* | |
* @return Builder | |
*/ | |
protected function newBaseQueryBuilder() | |
{ | |
$connection = $this->getConnection(); | |
$grammar = $conn->getQueryGrammar(); | |
return new Builder($connection, $grammar, $conn->getPostProcessor()); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Builder extends \Illuminate\Database\Query\Builder | |
{ | |
/** | |
* Add a single dynamic where clause statement to the query. | |
* | |
* @param string $segment | |
* @param string $connector | |
* @param array $parameters | |
* @param int $index | |
* | |
* @return void | |
*/ | |
protected function addDynamic($segment, $connector, $parameters, $index) | |
{ | |
$bool = strtolower($connector); | |
$this->where(camel_case($segment), '=', $parameters[$index], $bool); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment