Skip to content

Commit 758eda0

Browse files
authored
Merge pull request #52 from WL1981/patch-1
Added 404 responce
2 parents 8609ec6 + 955359a commit 758eda0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Http/Controllers/LiveContentController.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@ class LiveContentController
1818
*/
1919
public function show(Request $request): string
2020
{
21-
config(['storyblok.edit_mode' => true]);
2221

23-
$page = Storyblok::setData($request->get('data')['story'])->render();
22+
$data = $request->input('data');
23+
24+
if (!isset($data['story'])) {
25+
throw new \Illuminate\Http\Exceptions\HttpResponseException(response()->json(['message' => 'Story not found'], 404));
26+
}
27+
28+
config(['storyblok.edit_mode' => true]);
29+
30+
$page = Storyblok::setData($data['story'])->render();
2431
$dom = new HTML5DOMDocument();
2532
$dom->loadHTML($page);
2633

0 commit comments

Comments
 (0)