Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1234 | Revision 1334 | 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;
1247 lars 4
    use App\Http\Controllers\BackendUserController;
1118 lars 5
    use App\Http\Controllers\ToolboxController;
1093 lars 6
    use App\Models\Module;
1106 lars 7
    use App\Models\UserProperty;
1071 lars 8
    use App\Models\Web;
1076 lars 9
    use App\Models\WebProperty;
1107 lars 10
    use Illuminate\Support\Facades\Auth;
964 lars 11
    use Illuminate\Support\Facades\Route;
12
 
1197 lars 13
    setlocale( LC_TIME, 'de_DE.UTF-8' );
14
 
1071 lars 15
    $w = new Web();
16
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
1214 lars 17
    \View::share( "webs", $GLOBALS["web"] );
1204 lars 18
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
1205 lars 19
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
1203 lars 20
    {
21
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
22
    }
1197 lars 23
    $webRechte = WebProperty::with( [
24
        "property",
25
        "property.tool",
26
        "property.tool.module"
27
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
1107 lars 28
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
1092 lars 29
    \View::share( "navi", $navi );
1087 lars 30
    foreach ( $webRechte as $web_recht )
1081 lars 31
    {
1087 lars 32
        $property = $web_recht->property;
33
        $tool = $property->tool;
34
        $module = $tool->module;
1197 lars 35
        $GLOBALS["web_rechte"][ $module->interner_name ][ $tool->button_name ][ $property->interner_name ] = $web_recht->Bezeichnung;
1081 lars 36
    }
1088 lars 37
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
1110 lars 38
    if ( isset( $_SESSION["admin"]["uid"] ) )
1106 lars 39
    {
1110 lars 40
        $uId = $_SESSION["admin"]["uid"];
1108 lars 41
        $admin = $_SESSION["admin"]["user"]->admin;
42
        $user_rechte = $GLOBALS["web_rechte"];
43
        if ( !$admin )
44
        {
1197 lars 45
            $user_rechte = UserProperty::with( [
46
                "property",
47
                "tool",
48
                "module"
49
            ] )->where( "backend_user_id", "=", $uId )->get();
1108 lars 50
        }
1109 lars 51
        \View::share( "user_rechte", $user_rechte );
1106 lars 52
    }
1071 lars 53
 
1197 lars 54
    Route::get( '/login', [
55
        BackendController::class,
56
        'create'
57
    ] )->name( 'login' );
58
    Route::post( '/login', [
59
        BackendController::class,
60
        'store'
61
    ] );
1146 lars 62
    Route::middleware( 'auth:admin' )->group( function ()
964 lars 63
    {
1197 lars 64
        Route::get( '/logout', [
65
            BackendController::class,
66
            'destroy'
67
        ] )->name( 'logout' );
1117 lars 68
        Route::prefix( "/toolbox" )->group( function ()
69
        {
1197 lars 70
            Route::get( "/", [
71
                ToolboxController::class,
72
                "create"
73
            ] );
74
            Route::get( "/changeShopVersion", [
75
                ToolboxController::class,
76
                "changeShopVersion"
77
            ] );
1234 lars 78
            Route::get( "/updateShopVersion", [
1226 lars 79
                ToolboxController::class,
80
                "updateShopVersion"
81
            ] );
1227 lars 82
            Route::get( "/readSVNLog", [
83
                ToolboxController::class,
84
                "readSVNLog"
85
            ] );
1117 lars 86
        } );
1247 lars 87
        Route::resource('backend_users', BackendUserController::class);
1143 lars 88
        Route::view( "/", "admin/index" );
965 lars 89
    } );