I would like to create a REST application 404 response,
I have added the below code at the bottom of the router page,
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
$app->router->fallback(function () {
return response()->json(['success' => false],404);
});
I'm getting the below exception!
Call to undefined method Laravel\Lumen\Routing\Router::fallback()
But from the laravel documentation, I can use this method for 404 page. it's not working in lumen.
Can anybody help to solve this issue?