Skip to content

Commit

Permalink
Merge pull request #8532 from kenjis/docs-add-404-closure-sample-code
Browse files Browse the repository at this point in the history
docs: add sample code to get URI segments in 404 closure
  • Loading branch information
kenjis authored Feb 13, 2024
2 parents 3b1d8e3 + cf7ab9d commit a7f8163
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions user_guide_src/source/incoming/routing/069.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
// Would execute the show404 method of the App\Errors class
$routes->set404Override('App\Errors::show404');

// Will display a custom view
// Will display a custom view.
$routes->set404Override(static function () {
echo view('my_errors/not_found.html');
// If you want to get the URI segments.
$segments = request()->getUri()->getSegments();

return view('my_errors/not_found.html');
});

0 comments on commit a7f8163

Please sign in to comment.