Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1247 | Revision 1337 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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