Skip to content

Commit 62cd842

Browse files
Use firstOrFail in LessonController@show to return 404 for missing lessons
1 parent 6c525b0 commit 62cd842

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/Http/Controllers/LessonController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LessonController extends Controller
1010
{
1111
public function show(string $slug)
1212
{
13-
$lesson = Lesson::where('slug', $slug)->first();
13+
$lesson = Lesson::where('slug', $slug)->firstOrFail();
1414

1515
return new LessonResource($lesson);
1616
}

0 commit comments

Comments
 (0)