0

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() enter image description here

But from the laravel documentation, I can use this method for 404 page. it's not working in lumen. enter image description here

Can anybody help to solve this issue?

Kuppusamy
  • 453
  • 3
  • 11

0 Answers0