Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1167 | Revision 1203 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
964 lars 1
<?php
2
 
992 lars 3
    use App\Http\Controllers\BackendController;
1118 lars 4
    use App\Http\Controllers\ToolboxController;
1093 lars 5
    use App\Models\Module;
1106 lars 6
    use App\Models\UserProperty;
1071 lars 7
    use App\Models\Web;
1076 lars 8
    use App\Models\WebProperty;
1107 lars 9
    use Illuminate\Support\Facades\Auth;
964 lars 10
    use Illuminate\Support\Facades\Route;
11
 
1197 lars 12
    setlocale( LC_TIME, 'de_DE.UTF-8' );
13
 
1071 lars 14
    $w = new Web();
15
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
16
    \View::share( "web", $GLOBALS["web"] );
1197 lars 17
    $webRechte = WebProperty::with( [
18
        "property",
19
        "property.tool",
20
        "property.tool.module"
21
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
1107 lars 22
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
1092 lars 23
    \View::share( "navi", $navi );
1087 lars 24
    foreach ( $webRechte as $web_recht )
1081 lars 25
    {
1087 lars 26
        $property = $web_recht->property;
27
        $tool = $property->tool;
28
        $module = $tool->module;
1197 lars 29
        $GLOBALS["web_rechte"][ $module->interner_name ][ $tool->button_name ][ $property->interner_name ] = $web_recht->Bezeichnung;
1081 lars 30
    }
1088 lars 31
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
1110 lars 32
    if ( isset( $_SESSION["admin"]["uid"] ) )
1106 lars 33
    {
1110 lars 34
        $uId = $_SESSION["admin"]["uid"];
1108 lars 35
        $admin = $_SESSION["admin"]["user"]->admin;
36
        $user_rechte = $GLOBALS["web_rechte"];
37
        if ( !$admin )
38
        {
1197 lars 39
            $user_rechte = UserProperty::with( [
40
                "property",
41
                "tool",
42
                "module"
43
            ] )->where( "backend_user_id", "=", $uId )->get();
1108 lars 44
        }
1109 lars 45
        \View::share( "user_rechte", $user_rechte );
1106 lars 46
    }
1071 lars 47
 
1197 lars 48
    Route::get( '/login', [
49
        BackendController::class,
50
        'create'
51
    ] )->name( 'login' );
52
    Route::post( '/login', [
53
        BackendController::class,
54
        'store'
55
    ] );
1146 lars 56
    Route::middleware( 'auth:admin' )->group( function ()
964 lars 57
    {
1197 lars 58
        Route::get( '/logout', [
59
            BackendController::class,
60
            'destroy'
61
        ] )->name( 'logout' );
1117 lars 62
        Route::prefix( "/toolbox" )->group( function ()
63
        {
1197 lars 64
            Route::get( "/", [
65
                ToolboxController::class,
66
                "create"
67
            ] );
68
            Route::get( "/changeShopVersion", [
69
                ToolboxController::class,
70
                "changeShopVersion"
71
            ] );
1117 lars 72
        } );
1143 lars 73
        Route::view( "/", "admin/index" );
965 lars 74
    } );