I have three different Http namespaces in Laravel: Frontend, Backend, and API. There is also a different namespace for each route group. Here is an example code (frontend route group) from RouteServiceProvider:
protected function mapFrontendRoutes(Router $router) {
$router->group([
'namespace' => 'App\Http\Controllers\Frontend',
'middleware' => 'web',
], function ($router) {
require app_path('Http/Routes/frontend.php');
});
}
Now, I want to setup three different 404 pages for these namespaces/route groups:
- API - show 404 response in JSON format
- Frontend - errors/404.blade.php
- Backend - have a separate view in backend/errors/404.blade.php
How can I create these? I have been searching the web and have come across nothing regarding this.
Laravel version: 5.2