You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
| Web Routes
|
|
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
|
|
|
|
| routes are loaded by the RouteServiceProvider and all of them will
|
|
|
|
|
|
| be assigned to the "web" middleware group. Make something great!
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
Route::get('/', function () {
|
|
|
|
|
|
return view('welcome');
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
| 后台 Vue SPA(public/admin):子路径需回退到 index.html,否则刷新或直接打开
|
|
|
|
|
|
| /admin/xxx 会得到 404。若静态资源已由 Nginx 直出,通常不会进入此路由。
|
|
|
|
|
|
*/
|
|
|
|
|
|
Route::get('/admin/{path?}', function (?string $path = null) {
|
|
|
|
|
|
if ($path !== null && $path !== '') {
|
|
|
|
|
|
$candidate = public_path('admin/'.$path);
|
|
|
|
|
|
if (is_file($candidate)) {
|
|
|
|
|
|
return response()->file($candidate);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return response()->file(public_path('admin/index.html'));
|
|
|
|
|
|
})->where('path', '.*');
|