2019-10-29 15:33:36 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| API Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here is where you can register API routes for your application. These
|
|
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
|
|
| is assigned the "api" middleware group. Enjoy building your API!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
Route::prefix('v1')
|
|
|
|
->group(function () {
|
|
|
|
// Admin
|
|
|
|
Route::prefix('admin')
|
|
|
|
->middleware('admin')
|
|
|
|
->group(function () {
|
2020-01-29 16:08:50 +08:00
|
|
|
Route::any('/{class}/{action}', function($class, $action) {
|
2020-01-29 16:10:56 +08:00
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\Admin\\" . ucfirst($class) . "Controller");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
2019-10-29 15:33:36 +08:00
|
|
|
});
|
|
|
|
// User
|
|
|
|
Route::prefix('user')
|
|
|
|
->middleware('user')
|
|
|
|
->group(function () {
|
2020-01-29 16:08:50 +08:00
|
|
|
Route::any('/{action}', function($action) {
|
2020-01-29 16:09:39 +08:00
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\User\\UserController");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
|
|
|
Route::any('/{class}/{action}', function($class, $action) {
|
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\User\\" . ucfirst($class) . "Controller");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
2019-10-29 15:33:36 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
// Passport
|
|
|
|
Route::prefix('passport')
|
|
|
|
->group(function () {
|
2020-01-29 16:08:50 +08:00
|
|
|
Route::any('/{class}/{action}', function($class, $action) {
|
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\Passport\\" . ucfirst($class) . "Controller");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
2019-10-29 15:33:36 +08:00
|
|
|
});
|
|
|
|
// No Auth
|
|
|
|
Route::prefix('guest')
|
|
|
|
->group(function () {
|
2020-01-29 16:08:50 +08:00
|
|
|
Route::any('/{class}/{action}', function($class, $action) {
|
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\Guest\\" . ucfirst($class) . "Controller");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
2019-10-29 15:33:36 +08:00
|
|
|
});
|
|
|
|
// Client
|
|
|
|
Route::prefix('client')
|
|
|
|
->middleware('client')
|
|
|
|
->group(function () {
|
2020-01-29 16:08:50 +08:00
|
|
|
Route::any('/{action}', function($action) {
|
2020-01-29 16:09:39 +08:00
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\Client\\ClientController");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
|
|
|
Route::any('/{class}/{action}', function($class, $action) {
|
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\Client\\" . ucfirst($class) . "Controller");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
2019-10-29 15:33:36 +08:00
|
|
|
});
|
|
|
|
// Server
|
|
|
|
Route::prefix('server')
|
|
|
|
->group(function () {
|
2020-01-29 16:08:50 +08:00
|
|
|
Route::any('/{class}/{action}', function($class, $action) {
|
|
|
|
$ctrl = \App::make("\\App\\Http\\Controllers\\Server\\" . ucfirst($class) . "Controller");
|
2020-01-29 16:37:57 +08:00
|
|
|
return \App::call([$ctrl, $action]);
|
2020-01-29 16:08:50 +08:00
|
|
|
});
|
2019-10-29 15:33:36 +08:00
|
|
|
});
|
2020-01-11 13:36:52 +08:00
|
|
|
});
|