1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Http\Controllers;
7
8class FallbackController extends Controller
9{
10 public function __construct()
11 {
12 if (is_api_request()) {
13 $this->middleware('api');
14 } else {
15 $this->middleware('web');
16 }
17
18 parent::__construct();
19 }
20
21 public function index()
22 {
23 app('route-section')->setError(404);
24
25 if (is_json_request()) {
26 return error_popup(osu_trans('errors.missing_route'), 404);
27 }
28
29 return ext_view('layout.error', ['statusCode' => 404], 'html', 404);
30 }
31}