@@ 40-49 (lines=10) @@ | ||
37 | * @param int $id |
|
38 | * @return mixed |
|
39 | */ |
|
40 | public function find($id) |
|
41 | { |
|
42 | return $this->cache |
|
43 | ->tags($this->entityName, 'global') |
|
44 | ->remember("{$this->locale}.{$this->entityName}.find.{$id}", $this->cacheTime, |
|
45 | function () use ($id) { |
|
46 | return $this->repository->find($id); |
|
47 | } |
|
48 | ); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * @return \Illuminate\Database\Eloquent\Collection |
|
@@ 54-63 (lines=10) @@ | ||
51 | /** |
|
52 | * @return \Illuminate\Database\Eloquent\Collection |
|
53 | */ |
|
54 | public function all() |
|
55 | { |
|
56 | return $this->cache |
|
57 | ->tags($this->entityName, 'global') |
|
58 | ->remember("{$this->locale}.{$this->entityName}.all", $this->cacheTime, |
|
59 | function () { |
|
60 | return $this->repository->all(); |
|
61 | } |
|
62 | ); |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * Return all categories in the given language |
|
@@ 71-80 (lines=10) @@ | ||
68 | * @param string $lang |
|
69 | * @return object |
|
70 | */ |
|
71 | public function allTranslatedIn($lang) |
|
72 | { |
|
73 | return $this->cache |
|
74 | ->tags($this->entityName, 'global') |
|
75 | ->remember("{$this->locale}.{$this->entityName}.allTranslatedIn.{$lang}", $this->cacheTime, |
|
76 | function () use ($lang) { |
|
77 | return $this->repository->allTranslatedIn($lang); |
|
78 | } |
|
79 | ); |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * Find a resource by the given slug |
|
@@ 87-96 (lines=10) @@ | ||
84 | * @param string $slug |
|
85 | * @return object |
|
86 | */ |
|
87 | public function findBySlug($slug) |
|
88 | { |
|
89 | return $this->cache |
|
90 | ->tags($this->entityName, 'global') |
|
91 | ->remember("{$this->locale}.{$this->entityName}.findBySlug.{$slug}", $this->cacheTime, |
|
92 | function () use ($slug) { |
|
93 | return $this->repository->findBySlug($slug); |
|
94 | } |
|
95 | ); |
|
96 | } |
|
97 | ||
98 | /** |
|
99 | * Create a resource |
|
@@ 143-154 (lines=12) @@ | ||
140 | * @param array $attributes |
|
141 | * @return object |
|
142 | */ |
|
143 | public function findByAttributes(array $attributes) |
|
144 | { |
|
145 | $tagIdentifier = json_encode($attributes); |
|
146 | ||
147 | return $this->cache |
|
148 | ->tags($this->entityName, 'global') |
|
149 | ->remember("{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}", $this->cacheTime, |
|
150 | function () use ($attributes) { |
|
151 | return $this->repository->findByAttributes($attributes); |
|
152 | } |
|
153 | ); |
|
154 | } |
|
155 | ||
156 | /** |
|
157 | * Get resources by an array of attributes |
|
@@ 181-192 (lines=12) @@ | ||
178 | * @param array $ids |
|
179 | * @return mixed |
|
180 | */ |
|
181 | public function findByMany(array $ids) |
|
182 | { |
|
183 | $tagIdentifier = json_encode($ids); |
|
184 | ||
185 | return $this->cache |
|
186 | ->tags($this->entityName, 'global') |
|
187 | ->remember("{$this->locale}.{$this->entityName}.findByMany.{$tagIdentifier}", $this->cacheTime, |
|
188 | function () use ($ids) { |
|
189 | return $this->repository->findByMany($ids); |
|
190 | } |
|
191 | ); |
|
192 | } |
|
193 | ||
194 | /** |
|
195 | * Clear the cache for this Repositories' Entity |