Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1214 | Revision 1227 | 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();
1214 lars 16
    \View::share( "webs", $GLOBALS["web"] );
1204 lars 17
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
1205 lars 18
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
1203 lars 19
    {
20
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
21
    }
1197 lars 22
    $webRechte = WebProperty::with( [
23
        "property",
24
        "property.tool",
25
        "property.tool.module"
26
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
1107 lars 27
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
1092 lars 28
    \View::share( "navi", $navi );
1087 lars 29
    foreach ( $webRechte as $web_recht )
1081 lars 30
    {
1087 lars 31
        $property = $web_recht->property;
32
        $tool = $property->tool;
33
        $module = $tool->module;
1197 lars 34
        $GLOBALS["web_rechte"][ $module->interner_name ][ $tool->button_name ][ $property->interner_name ] = $web_recht->Bezeichnung;
1081 lars 35
    }
1088 lars 36
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
1110 lars 37
    if ( isset( $_SESSION["admin"]["uid"] ) )
1106 lars 38
    {
1110 lars 39
        $uId = $_SESSION["admin"]["uid"];
1108 lars 40
        $admin = $_SESSION["admin"]["user"]->admin;
41
        $user_rechte = $GLOBALS["web_rechte"];
42
        if ( !$admin )
43
        {
1197 lars 44
            $user_rechte = UserProperty::with( [
45
                "property",
46
                "tool",
47
                "module"
48
            ] )->where( "backend_user_id", "=", $uId )->get();
1108 lars 49
        }
1109 lars 50
        \View::share( "user_rechte", $user_rechte );
1106 lars 51
    }
1071 lars 52
 
1197 lars 53
    Route::get( '/login', [
54
        BackendController::class,
55
        'create'
56
    ] )->name( 'login' );
57
    Route::post( '/login', [
58
        BackendController::class,
59
        'store'
60
    ] );
1146 lars 61
    Route::middleware( 'auth:admin' )->group( function ()
964 lars 62
    {
1197 lars 63
        Route::get( '/logout', [
64
            BackendController::class,
65
            'destroy'
66
        ] )->name( 'logout' );
1117 lars 67
        Route::prefix( "/toolbox" )->group( function ()
68
        {
1197 lars 69
            Route::get( "/", [
70
                ToolboxController::class,
71
                "create"
72
            ] );
73
            Route::get( "/changeShopVersion", [
74
                ToolboxController::class,
75
                "changeShopVersion"
76
            ] );
1226 lars 77
            Route::post( "/changeShopVersion", [
78
                ToolboxController::class,
79
                "updateShopVersion"
80
            ] );
1117 lars 81
        } );
1143 lars 82
        Route::view( "/", "admin/index" );
965 lars 83
    } );