mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 13:41:09 -04:00 
			
		
		
		
	build version 400
This commit is contained in:
		| @ -1,19 +1,32 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Crater\Providers; | ||||
|  | ||||
| use Illuminate\Cache\RateLimiting\Limit; | ||||
| use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; | ||||
| use Illuminate\Http\Request; | ||||
| use Illuminate\Support\Facades\RateLimiter; | ||||
| use Illuminate\Support\Facades\Route; | ||||
|  | ||||
| class RouteServiceProvider extends ServiceProvider | ||||
| { | ||||
|     /** | ||||
|      * This namespace is applied to your controller routes. | ||||
|      * The path to the "home" route for your application. | ||||
|      * | ||||
|      * In addition, it is set as the URL generator's root namespace. | ||||
|      * This is used by Laravel authentication to redirect users after login. | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $namespace = 'Crater\Http\Controllers'; | ||||
|     public const HOME = '/admin/dashboard'; | ||||
|  | ||||
|     /** | ||||
|      * The controller namespace for the application. | ||||
|      * | ||||
|      * When present, controller route declarations will automatically be prefixed with this namespace. | ||||
|      * | ||||
|      * @var string|null | ||||
|      */ | ||||
|     // protected $namespace = 'Crater\\Http\\Controllers'; | ||||
|  | ||||
|     /** | ||||
|      * Define your route model bindings, pattern filters, etc. | ||||
| @ -22,51 +35,29 @@ class RouteServiceProvider extends ServiceProvider | ||||
|      */ | ||||
|     public function boot() | ||||
|     { | ||||
|         // | ||||
|         $this->configureRateLimiting(); | ||||
|  | ||||
|         parent::boot(); | ||||
|         $this->routes(function () { | ||||
|             Route::prefix('api') | ||||
|                 ->middleware('api') | ||||
|                 ->namespace($this->namespace) | ||||
|                 ->group(base_path('routes/api.php')); | ||||
|  | ||||
|             Route::middleware('web') | ||||
|                 ->namespace($this->namespace) | ||||
|                 ->group(base_path('routes/web.php')); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Define the routes for the application. | ||||
|      * Configure the rate limiters for the application. | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
|     public function map() | ||||
|     protected function configureRateLimiting() | ||||
|     { | ||||
|         $this->mapApiRoutes(); | ||||
|  | ||||
|         $this->mapWebRoutes(); | ||||
|  | ||||
|         // | ||||
|         RateLimiter::for('api', function (Request $request) { | ||||
|             return Limit::perMinute(60); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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')); | ||||
|     } | ||||
| } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user