Subversion-Projekte lars-tiefland.laravel_shop

Revision

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