summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/scorm-player.php5
-rw-r--r--routes/web.php24
2 files changed, 20 insertions, 9 deletions
diff --git a/config/scorm-player.php b/config/scorm-player.php
index 74f89fa..95f2a5f 100644
--- a/config/scorm-player.php
+++ b/config/scorm-player.php
@@ -1,5 +1,10 @@
<?php
return [
+ 'route_prefix' => '',
+ 'route_prefix_scorm' => 'scorm',
+ 'route_prefix_player' => 'player',
+ 'route_prefix_files' => 'files',
+ 'middleware_group' => 'web',
'middleware' => '',
];
diff --git a/routes/web.php b/routes/web.php
index 4570f11..8613ef7 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -2,23 +2,29 @@
use Illuminate\Support\Facades\Route;
-//use Illuminate\Routing\Middleware\SubstituteBindings;
-
use Lightscale\ScormPlayer\Http\Controllers\ScormPlayerController;
-Route::name('scorm-player.')->prefix('elearning')->middleware([
- 'web',
+Route::name('scorm-player.')->prefix(config('scorm.route_prefix'))->middleware([
+ config('scorm.middleware_group', 'web'),
])->group(function() {
Route::get('scorm-player-{version}.js', [ScormPlayerController::class, 'jsSource'])
->name('javascript');
$group = function() {
- Route::get('/scorm/{sco}', 'scormLoad')->name('scorm.load');
- Route::post('/scorm/{tracking}', 'scormCommit')->name('scorm.commit');
-
- Route::get('{module:uuid}', 'player')->name('player');
- Route::get('files/{uuid}/{path}', 'serveModule')->name('serve')->where('path', '.*');
+ Route::prefix(config('scorm.route_prefix_scorm'))->group(function() {
+ Route::get('{sco}', 'scormLoad')->name('scorm.load');
+ Route::post('{tracking}', 'scormCommit')->name('scorm.commit');
+ });
+
+ Route::prefix(config('scorm.route_prefix_player'))
+ ->get('{module:uuid}', 'player')
+ ->name('player');
+
+ Route::prefix(config('scorm.route_prefix_files'))
+ ->get('{uuid}/{path}', 'serveModule')
+ ->where('path', '.*')
+ ->name('serve');
};
$route = Route::controller(ScormPlayerController::class);