You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,32 @@ use Illuminate\Database\Eloquent\Builder;
90
90
use Freevital\Repository\Contracts\CriteriaContract;
91
91
use Freevital\Repository\Contracts\RepositoryContract;
92
92
93
+
class BySlugCriteria implements CriteriaContract
94
+
{
95
+
/**
96
+
* Apply criteria in query repository.
97
+
*
98
+
* @param Builder $query
99
+
* @param RepositoryContract $repository
100
+
*
101
+
* @return \Illuminate\Database\Eloquent\Builder
102
+
*/
103
+
public function apply(Builder $query, RepositoryContract $repository)
104
+
{
105
+
return $query->with('comments.users');
106
+
}
107
+
}
108
+
```
109
+
110
+
You may TODO
111
+
112
+
```php
113
+
namespace App\Repositories\Criteria;
114
+
115
+
use Illuminate\Database\Eloquent\Builder;
116
+
use Freevital\Repository\Contracts\CriteriaContract;
117
+
use Freevital\Repository\Contracts\RepositoryContract;
118
+
93
119
class BySlugCriteria implements CriteriaContract
94
120
{
95
121
/**
@@ -155,7 +181,6 @@ class PostController extends Controller
155
181
156
182
## Criteria Macros
157
183
158
-
159
184
If you would like to extend the repository functionality with custom common scope (ex. ActiveCriteria), you may use BaseRepository's macro method. For example, from a service provider's boot method:
0 commit comments