Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
8198dc23
Commit
8198dc23
authored
Jul 07, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #874 from franzliedke/patch-16
[Eloquent] Constraining eager loads only allows WHERE clauses
parents
69e1ea93
39df69fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
19 deletions
+2
-19
query.php
laravel/database/query.php
+2
-19
No files found.
laravel/database/query.php
View file @
8198dc23
...
...
@@ -395,7 +395,7 @@ class Query {
}
/**
* Add
a nested where condition
to the query.
* Add
nested constraints
to the query.
*
* @param Closure $callback
* @param string $connector
...
...
@@ -403,24 +403,7 @@ class Query {
*/
public
function
where_nested
(
$callback
,
$connector
=
'AND'
)
{
$type
=
'where_nested'
;
// To handle a nested where statement, we will actually instantiate a new
// Query instance and run the callback over that instance, which will
// allow the developer to have a fresh query instance
$query
=
new
Query
(
$this
->
connection
,
$this
->
grammar
,
$this
->
from
);
call_user_func
(
$callback
,
$query
);
// Once the callback has been run on the query, we will store the nested
// query instance on the where clause array so that it's passed to the
// query's query grammar instance when building.
if
(
$query
->
wheres
!==
null
)
{
$this
->
wheres
[]
=
compact
(
'type'
,
'query'
,
'connector'
);
}
$this
->
bindings
=
array_merge
(
$this
->
bindings
,
$query
->
bindings
);
call_user_func
(
$callback
,
$this
);
return
$this
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment