love_php/app/Providers/RouteServiceProvider.php
2026-04-02 09:20:51 +08:00

180 lines
4.9 KiB
PHP

<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
protected $admin_namespace = 'App\Http\Controllers';
protected $server_admin_namespace = 'App\Http\Controllers\Server\Admin';
protected $server_h5_namespace = 'App\Http\Controllers\Server\H5';
protected $server_m_admin_namespace = 'App\Http\Controller\Server\Madmin';
protected $server_App_namespace = 'App\Http\Controllers\Server\App';
protected $enterprise_alliance_admin_space = 'App\Http\Controllers\Server\Enterprise';
protected $enterprise_alliance_h5_space = 'App\Http\Controllers\Server\EnterpriseH5';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapAdminApiRoutes();
$this->mapWebRoutes();
$this->mapOfficialApiRoutes();
$this->mapAppApiRoutes();
$this->mapServerAdminApiRoutes();
$this->mapServerH5ApiRoutes();
$this->mapServerMAdminApiRoutes();
$this->mapServerMAppApiRoutes();
$this->mapEnterpriseAdminRoutes();
$this->mapEnterpriseH5Routes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapAdminApiRoutes()
{
Route::prefix('api/admin')
->middleware('api')
->namespace($this->admin_namespace)
->group(base_path('routes/admin/api.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapOfficialApiRoutes()
{
Route::prefix('api/official')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/official/api.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
public function mapAppApiRoutes()
{
Route::prefix('api/app')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/app/api.php'));
}
public function mapServerH5ApiRoutes()
{
Route::prefix('api/s/h5')
->middleware("api")
->namespace($this->server_h5_namespace)
->group(base_path('routes/server/h5/api.php'));
}
public function mapServerMAppApiRoutes()
{
Route::prefix('api/s/app')
->middleware("api")
->namespace($this->server_App_namespace)
->group(base_path('routes/server/app/api.php'));
}
public function mapServerAdminApiRoutes()
{
Route::prefix('api/s/admin')
->middleware('api')
->namespace($this->server_admin_namespace)
->group(base_path('routes/server/admin/api.php'));
}
public function mapServerMAdminApiRoutes()
{
Route::prefix('api/s/m/admin')
->middleware('api')
->namespace($this->server_admin_namespace)
->group(base_path('routes/server/m_admin/api.php'));
}
public function mapEnterpriseAdminRoutes()
{
Route::prefix('api/s/enterprise/admin')
->middleware('api')
->namespace($this->enterprise_alliance_admin_space)
->group(base_path('routes/server/enterprise/admin/api.php'));
}
public function mapEnterpriseH5Routes()
{
Route::prefix('api/s/enterprise/h5')
->middleware('api')
->namespace($this->enterprise_alliance_h5_space)
->group(base_path('routes/server/enterprise/h5/api.php'));
}
}