Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
Platform
Commits
146d9d94
Commit
146d9d94
authored
Oct 30, 2018
by
Silvio Gratani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed pull request
parent
ee85cd22
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
3 deletions
+39
-3
BaseRepository.php
Modules/Core/Repositories/BaseRepository.php
+16
-0
BaseCacheDecorator.php
Modules/Core/Repositories/Cache/BaseCacheDecorator.php
+20
-0
EloquentBaseRepository.php
...les/Core/Repositories/Eloquent/EloquentBaseRepository.php
+3
-3
No files found.
Modules/Core/Repositories/BaseRepository.php
View file @
146d9d94
...
...
@@ -98,4 +98,20 @@ interface BaseRepository
* @return bool
*/
public
function
clearCache
();
/**
* Add where statement to current builder
*
* @param string $field
* @param string|int $value
* @param string $operator
*/
public
function
where
(
string
$field
,
$value
,
string
$operator
=
null
);
/**
* Eager relationship(s) loading
*
* @param array|string $relationships
*/
public
function
with
(
$relationships
);
}
Modules/Core/Repositories/Cache/BaseCacheDecorator.php
View file @
146d9d94
...
...
@@ -220,4 +220,24 @@ abstract class BaseCacheDecorator implements BaseRepository
$this
->
entityName
);
}
/**
* @inheritdoc
*/
public
function
where
(
string
$field
,
$value
,
string
$operator
=
null
)
{
return
$this
->
remember
(
function
()
use
(
$field
,
$value
,
$operator
)
{
return
$this
->
repository
->
where
(
$field
,
$value
,
$operator
);
});
}
/**
* @inheritdoc
*/
public
function
with
(
$relationships
)
{
return
$this
->
remember
(
function
()
use
(
$relationships
)
{
return
$this
->
repository
->
with
(
$relationships
);
});
}
}
Modules/Core/Repositories/Eloquent/EloquentBaseRepository.php
View file @
146d9d94
...
...
@@ -195,10 +195,10 @@ abstract class EloquentBaseRepository implements BaseRepository
/**
* @inheritdoc
*/
public
function
where
(
$field
,
$value
,
$operator
=
null
)
public
function
where
(
string
$field
,
$value
,
string
$operator
=
null
)
{
if
(
null
==
$operator
)
{
$operator
=
'='
;
if
(
$operator
===
null
)
{
$operator
=
'='
;
}
else
{
list
(
$value
,
$operator
)
=
[
$operator
,
$value
];
}
...
...
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