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
39df69fd
Commit
39df69fd
authored
Jun 28, 2012
by
Franz Liedke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow more than just WHERE clauses on eager load constraints.
parent
2d4fa721
Changes
1
Show 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 @
39df69fd
...
@@ -395,7 +395,7 @@ class Query {
...
@@ -395,7 +395,7 @@ class Query {
}
}
/**
/**
* Add
a nested where condition
to the query.
* Add
nested constraints
to the query.
*
*
* @param Closure $callback
* @param Closure $callback
* @param string $connector
* @param string $connector
...
@@ -403,24 +403,7 @@ class Query {
...
@@ -403,24 +403,7 @@ class Query {
*/
*/
public
function
where_nested
(
$callback
,
$connector
=
'AND'
)
public
function
where_nested
(
$callback
,
$connector
=
'AND'
)
{
{
$type
=
'where_nested'
;
call_user_func
(
$callback
,
$this
);
// 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
);
return
$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