123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <?php
- namespace App\Providers;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Route;
- use Illuminate\Cache\RateLimiting\Limit;
- use Illuminate\Support\Facades\RateLimiter;
- use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
- class RouteServiceProvider extends ServiceProvider
- {
- /**
- * The path to the "home" route for your application.
- *
- * This is used by Laravel authentication to redirect users after login.
- *
- * @var string
- */
- public const HOME = '/home';
- /**
- * The controller namespace for the application.
- *
- * When present, controller route declarations will automatically be prefixed with this namespace.
- *
- * @var string|null
- */
- // protected $namespace = 'App\\Http\\Controllers';
- /**
- * Define your route model bindings, pattern filters, etc.
- *
- * @return void
- */
- public function boot()
- {
- $this->configureRateLimiting();
- $this->routes(function () {
- Route::prefix('dabory-app')
- ->middleware('api')
- ->namespace($this->namespace)
- ->group(base_path('routes/api.php'));
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(base_path('routes/web.php'));
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(base_path('routes/dabory.php'));
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(base_path('routes/myapp.php'));
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(base_path('routes/my-app.php'));
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(base_path('routes/shop.php'));
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(base_path('routes/local/file.php'));
- $this->mapWebRoutes();
- });
- }
- protected function mapWebRoutes()
- {
- // pro
- $langPath = public_path('themes/pro/' . env('DBR_THEME') . '/resources/lang');
- $this->loadTranslationsFrom($langPath, env('DBR_THEME'));
- $this->loadJsonTranslationsFrom($langPath);
- if (env('DBR_THEME')) {
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(daboryPath('themes/' . env('DBR_THEME') . '/pro/routes/web.php'));
- $erpRoutePath = 'themes/' . env('DBR_THEME') . '/erp/routes/web.php';
- if (file_exists(daboryPath($erpRoutePath))) {
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(daboryPath($erpRoutePath));
- }
- $strongErpRoutePath = 'themes/' . env('DBR_THEME') . '/strong/frontend/erp/routes/web.php';
- if (file_exists(daboryPath($strongErpRoutePath))) {
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(daboryPath($strongErpRoutePath));
- }
- $strongProRoutePath = 'themes/' . env('DBR_THEME') . '/strong/frontend/pro/routes/web.php';
- if (file_exists(daboryPath($strongProRoutePath))) {
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(daboryPath($strongProRoutePath));
- }
- $strongMyappRoutePath = 'themes/' . env('DBR_THEME') . '/strong/frontend/myapp/routes/web.php';
- if (file_exists(daboryPath($strongMyappRoutePath))) {
- Route::middleware('web')
- ->namespace($this->namespace)
- ->group(daboryPath($strongMyappRoutePath));
- }
- }
- // erp
- // $erpThemes = preg_replace('/\s+/', '', explode(',', env('ERP_THEMES')));
- // foreach ($erpThemes as $theme) {
- // if (empty($theme)) { continue; }
- // Route::middleware('web')
- // ->namespace($this->namespace)
- // ->group(daboryPath("themes/$theme/erp/routes/web.php"));
- // }
- }
- /**
- * Configure the rate limiters for the application.
- *
- * @return void
- */
- protected function configureRateLimiting()
- {
- RateLimiter::for('api', function (Request $request) {
- return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
- });
- }
- }
|