Skip to content

Commit d44663e

Browse files
committed
Add middleware and new API route for request analytics
Enhanced the web route by adding middleware for authentication and access control. Introduced a separate API route under `/api/v1` with preliminary JSON response for future expansion. These changes improve security and extend functionality.
1 parent 27c4c93 commit d44663e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

routes/web.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,14 @@
33
use Illuminate\Support\Facades\Route;
44
use MeShaon\RequestAnalytics\Controllers\RequestAnalyticsController;
55

6-
Route::get(config('request-analytics.route.pathname'), [RequestAnalyticsController::class, 'show'])
6+
Route::middleware(['web', 'auth', 'request-analytics.access'])
7+
->get(config('request-analytics.route.pathname'), [RequestAnalyticsController::class, 'show'])
78
->name(config('request-analytics.route.name'));
9+
10+
Route::middleware(['api', 'auth:sanctum', 'request-analytics.access'])
11+
->get('api/v1'.config('request-analytics.route.pathname'), function () {
12+
return response()->json([
13+
'data' => 'Coming soon...',
14+
]);
15+
})->name(config('request-analytics.route.name').'.api');
16+

0 commit comments

Comments
 (0)