summaryrefslogtreecommitdiff
path: root/routes/web.php
blob: 4570f1182030e80d58bd28f540a314f92c0e87f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

use Illuminate\Support\Facades\Route;

//use Illuminate\Routing\Middleware\SubstituteBindings;

use Lightscale\ScormPlayer\Http\Controllers\ScormPlayerController;

Route::name('scorm-player.')->prefix('elearning')->middleware([
    '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 = Route::controller(ScormPlayerController::class);
    $middleware = config('scorm.middleware');

    if(!empty($middleware)) {
        $route->middleware($middleware);
    }

    $route->group($group);

});