Skip to content

Commit a7f8163

Browse files
authored
Merge pull request #8532 from kenjis/docs-add-404-closure-sample-code
docs: add sample code to get URI segments in 404 closure
2 parents 3b1d8e3 + cf7ab9d commit a7f8163

File tree

1 file changed

+5
-2
lines changed
  • user_guide_src/source/incoming/routing

1 file changed

+5
-2
lines changed

user_guide_src/source/incoming/routing/069.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
// Would execute the show404 method of the App\Errors class
55
$routes->set404Override('App\Errors::show404');
66

7-
// Will display a custom view
7+
// Will display a custom view.
88
$routes->set404Override(static function () {
9-
echo view('my_errors/not_found.html');
9+
// If you want to get the URI segments.
10+
$segments = request()->getUri()->getSegments();
11+
12+
return view('my_errors/not_found.html');
1013
});

0 commit comments

Comments
 (0)