@@ 18-33 (lines=16) @@ | ||
15 | ||
16 | $this->mergeConfigFrom(__DIR__.'/../config/query-builder.php', 'query-builder'); |
|
17 | ||
18 | Request::macro('includes', function ($include = null) { |
|
19 | $parameter = config('query-builder.parameters.include'); |
|
20 | $includeParts = $this->query($parameter); |
|
21 | ||
22 | if (! is_array($includeParts)) { |
|
23 | $includeParts = explode(',', strtolower($this->query($parameter))); |
|
24 | } |
|
25 | ||
26 | $includes = collect($includeParts)->filter(); |
|
27 | ||
28 | if (is_null($include)) { |
|
29 | return $includes; |
|
30 | } |
|
31 | ||
32 | return $includes->contains(strtolower($include)); |
|
33 | }); |
|
34 | ||
35 | Request::macro('appends', function ($append = null) { |
|
36 | $parameter = config('query-builder.parameters.append'); |
|
@@ 35-50 (lines=16) @@ | ||
32 | return $includes->contains(strtolower($include)); |
|
33 | }); |
|
34 | ||
35 | Request::macro('appends', function ($append = null) { |
|
36 | $parameter = config('query-builder.parameters.append'); |
|
37 | $appendParts = $this->query($parameter); |
|
38 | ||
39 | if (! is_array($appendParts)) { |
|
40 | $appendParts = explode(',', strtolower($this->query($parameter))); |
|
41 | } |
|
42 | ||
43 | $appends = collect($appendParts)->filter(); |
|
44 | ||
45 | if (is_null($append)) { |
|
46 | return $appends; |
|
47 | } |
|
48 | ||
49 | return $appends->contains(strtolower($append)); |
|
50 | }); |
|
51 | ||
52 | Request::macro('filters', function ($filter = null) { |
|
53 | $filterParts = $this->query( |