Subversion-Projekte lars-tiefland.laravel_shop

Revision

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