Skip to content

Commit f81c08c

Browse files
authored
Merge pull request #71 from openclassify/vedatakdogann
fix exception
2 parents 7e85ecb + 89e52f7 commit f81c08c

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

src/Command/PurgeHttpCache.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ public function handle()
4242

4343
$stream = $this->entry->getStreamSlug();
4444
$namespace = $this->entry->getStreamNamespace();
45-
dd(array_filter(
46-
[
47-
"api/entries/{$namespace}/{$stream}",
48-
"api/entries/{$namespace}/{$stream}/{id}",
49-
]
50-
));
45+
5146
array_map(
5247
function ($route) use ($cache) {
5348
$cache->purge(parse_url($route, PHP_URL_PATH));

src/Resource/Repository/EloquentResourceRepository.php

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,19 @@ public function getApiCollectionWithModel($model)
121121

122122
public function getRepositoryFunctions($model, $function_name, array $params = [])
123123
{
124+
$collection_class = $this->getApiCollectionWithModel($this->model);
124125

125-
try {
126-
127-
$collection_class = $this->getApiCollectionWithModel($this->model);
128-
129-
// Default set Repository
130-
$class = app($this->getRepositoryWithModel($model));
131-
132-
if (class_exists($collection_class)) {
133-
134-
// Set ApiCollection
135-
$class = app($collection_class);
136-
}
126+
// Default set Repository
127+
$class = app($this->getRepositoryWithModel($model));
137128

129+
if (class_exists($collection_class)) {
138130

139-
return call_user_func([$class, camel_case($function_name)], $params);
131+
// Set ApiCollection
132+
$class = app($collection_class);
133+
}
140134

141135

142-
} catch (\Exception $exception) {
143-
header('Content-Type: application/json');
144-
echo json_encode(['status' => false, 'message' => $exception->getMessage()]);
145-
die;
146-
}
136+
return call_user_func([$class, camel_case($function_name)], $params);
147137
}
148138

149139
public function returnRaw($raw, $builder)
@@ -171,7 +161,7 @@ public function returnRaw($raw, $builder)
171161
*/
172162
$offset = $limit * (app('request')->get('page', 1) - 1);
173163

174-
if ($builder->getOption('paginate',true)) {
164+
if ($builder->getOption('paginate', true)) {
175165
$query .= " LIMIT " . $limit . " OFFSET " . $offset;
176166
}
177167

@@ -253,7 +243,7 @@ public function returnQuerying($query, $builder)
253243
*/
254244
$offset = $limit * (app('request')->get('page', 1) - 1);
255245

256-
if ($builder->getOption('paginate',true)) {
246+
if ($builder->getOption('paginate', true)) {
257247
$query->take($limit)->offset($offset);
258248
}
259249

0 commit comments

Comments
 (0)