Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1679 | 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;
1522 lars 4
    use App\Http\Controllers\ActionMediumController;
992 lars 5
    use App\Http\Controllers\BackendController;
1247 lars 6
    use App\Http\Controllers\BackendUserController;
1550 lars 7
    use App\Http\Controllers\MediumController;
1337 lars 8
    use App\Http\Controllers\OrderController;
1679 lars 9
    use App\Http\Controllers\ShippingController;
1683 lars 10
    use App\Http\Controllers\ShippingGroupController;
1118 lars 11
    use App\Http\Controllers\ToolboxController;
1093 lars 12
    use App\Models\Module;
1448 lars 13
    use App\Models\OrderType;
1449 lars 14
    use App\Models\Shop;
1106 lars 15
    use App\Models\UserProperty;
1071 lars 16
    use App\Models\Web;
1076 lars 17
    use App\Models\WebProperty;
964 lars 18
    use Illuminate\Support\Facades\Route;
19
 
1197 lars 20
    setlocale( LC_TIME, 'de_DE.UTF-8' );
1385 lars 21
 
22
    $w = new Web();
23
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
1408 lars 24
    if ( php_sapi_name() != "cli" )
1384 lars 25
    {
1408 lars 26
        if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/admin/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
27
        {
28
            require_once "styles.php";
29
        }
1384 lars 30
    }
1214 lars 31
    \View::share( "webs", $GLOBALS["web"] );
1447 lars 32
    $c_bestellarten = array();
33
    $c_shops = array();
34
    $d_shops = array();
35
    $ba = OrderType::get();
1446 lars 36
    foreach ( $ba as $ba_id => $bestellart )
37
    {
1447 lars 38
        $c_bestellarten[$bestellart->id] = $bestellart->name;
1446 lars 39
    }
40
    $shops = Shop::get();
1496 lars 41
    View::share( "shops", $shops );
1446 lars 42
    foreach ( $shops as $s_id => $shop )
43
    {
44
        $c_shops[$shop->id] = $shop->name;
45
        $d_shops[$shop->id] = $shop;
46
    }
1450 lars 47
    \View::share( "c_bestellarten", $c_bestellarten );
1446 lars 48
    \View::share( "c_shops", $c_shops );
49
    \View::share( "d_shops", $d_shops );
1204 lars 50
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
1205 lars 51
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
1203 lars 52
    {
53
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
54
    }
1197 lars 55
    $webRechte = WebProperty::with( [
56
        "property",
57
        "property.tool",
58
        "property.tool.module"
59
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
1107 lars 60
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
1092 lars 61
    \View::share( "navi", $navi );
1087 lars 62
    foreach ( $webRechte as $web_recht )
1081 lars 63
    {
1087 lars 64
        $property = $web_recht->property;
65
        $tool = $property->tool;
66
        $module = $tool->module;
1446 lars 67
        $GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
1081 lars 68
    }
1088 lars 69
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
1110 lars 70
    if ( isset( $_SESSION["admin"]["uid"] ) )
1106 lars 71
    {
1110 lars 72
        $uId = $_SESSION["admin"]["uid"];
1108 lars 73
        $admin = $_SESSION["admin"]["user"]->admin;
74
        $user_rechte = $GLOBALS["web_rechte"];
75
        if ( !$admin )
76
        {
1197 lars 77
            $user_rechte = UserProperty::with( [
78
                "property",
79
                "tool",
80
                "module"
81
            ] )->where( "backend_user_id", "=", $uId )->get();
1108 lars 82
        }
1109 lars 83
        \View::share( "user_rechte", $user_rechte );
1106 lars 84
    }
1071 lars 85
 
1197 lars 86
    Route::get( '/login', [
87
        BackendController::class,
88
        'create'
89
    ] )->name( 'login' );
90
    Route::post( '/login', [
91
        BackendController::class,
92
        'store'
93
    ] );
1146 lars 94
    Route::middleware( 'auth:admin' )->group( function ()
964 lars 95
    {
1197 lars 96
        Route::get( '/logout', [
97
            BackendController::class,
98
            'destroy'
99
        ] )->name( 'logout' );
1117 lars 100
        Route::prefix( "/toolbox" )->group( function ()
101
        {
1197 lars 102
            Route::get( "/", [
103
                ToolboxController::class,
104
                "create"
105
            ] );
106
            Route::get( "/changeShopVersion", [
107
                ToolboxController::class,
108
                "changeShopVersion"
109
            ] );
1234 lars 110
            Route::get( "/updateShopVersion", [
1226 lars 111
                ToolboxController::class,
112
                "updateShopVersion"
113
            ] );
1227 lars 114
            Route::get( "/readSVNLog", [
115
                ToolboxController::class,
116
                "readSVNLog"
117
            ] );
1117 lars 118
        } );
1550 lars 119
        Route::resource( 'media', MediumController::class );
1384 lars 120
        Route::resource( 'actions', ActionController::class );
1679 lars 121
        Route::resource( "Online-Shop/Shippings", ShippingController::class );
1683 lars 122
        Route::resource( "Online-Shop/ShippingGroups", ShippingGroupController::class );
1522 lars 123
        Route::get( "/actions/{id}/getMedia", [ ActionMediumController::class, "liste" ] );
1384 lars 124
        Route::resource( 'backend_users', BackendUserController::class );
125
        Route::resource( 'orders', OrderController::class );
1143 lars 126
        Route::view( "/", "admin/index" );
1405 lars 127
    } );