Skip to content

Commit f6b73a0

Browse files
add 404
1 parent 143996b commit f6b73a0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Controllers/SlugController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ class SlugController extends Controller
1111
public function index(Request $request, $slug)
1212
{
1313
$slug = Slug::findBySlug($slug);
14-
$model = $slug->model;
15-
if($model){
16-
return $model->getController();
14+
if ($slug) {
15+
$model = $slug->model;
16+
if ($model) {
17+
return $model->getController();
18+
}
1719
}
20+
abort(404, 'slug not found');
1821
}
1922
}

0 commit comments

Comments
 (0)