Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1110 | Revision 1112 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

    use App\Http\Controllers\BackendController;
    use App\Models\Module;
    use App\Models\UserProperty;
    use App\Models\Web;
    use App\Models\WebProperty;
    use Illuminate\Support\Facades\Auth;
    use Illuminate\Support\Facades\Route;

    /*$bc = new BackendController();
    $user_rechte = $bc->getUserRechte();
    \View::share( "user_rechte", $user_rechte );*/

    $w = new Web();
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
    \View::share( "web", $GLOBALS["web"] );
    $webRechte = WebProperty::with( [ "property", "property.tool", "property.tool.module" ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
    \View::share( "navi", $navi );
    foreach ( $webRechte as $web_recht )
    {
        $property = $web_recht->property;
        $tool = $property->tool;
        $module = $tool->module;
        $GLOBALS["web_rechte"][$module->name][$tool->button_name][$property->interner_name] = $property->Bezeichnung;
    }
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
    if ( isset( $_SESSION["admin"]["uid"] ) )
    {
        $uId = $_SESSION["admin"]["uid"];
        $admin = $_SESSION["admin"]["user"]->admin;
        $user_rechte = $GLOBALS["web_rechte"];
        if ( !$admin )
        {
            $user_rechte = UserProperty::with( [ "property", "tool", "module" ] )->where( "backend_user_id", "=", $uId )->get();
        }
        \View::share( "user_rechte", $user_rechte );
    }
    //dump( $web_rechte );

    $_SESSION["jquery_js"] = "/js/jquery-1.7.2.min.js";
    $_SESSION["jquery_ui_js"] = "/js/jquery-ui-1.8.23.custom.min.js";
    $_SESSION["jquery_style"] = "/css/start/jquery-ui.custom.css";

    $_SESSION["jquery_new"] = "/css/start_new/jquery.min.js";
    $_SESSION["jquery_ui_new"] = "/css/start_new/jquery-ui.min.js";
    $_SESSION["jquery_style_new"] = "/css/start_new/jquery-ui.custom.css";

    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";

    /*if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/css/" . $site . "/jquery-ui.custom.css" ) )
    {
        $_SESSION["jquery_style"] = "/css/" . $site . "/jquery-ui.custom.css";
    }

    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/css/" . $site . "/images/loading.gif" ) )
    {
        $_SESSION["loadingGif"] = "/css/" . $site . "/images/loading.gif";
    }

    if ( file_Exists( $_SERVER["DOCUMENT_ROOT"] . "/css/" . $site . "_new/jquery.min.js" ) )
    {
        $_SESSION["jquery_new"] = "/css/" . $site . "_new/jquery.min.js";
        $_SESSION["jquery_ui_new"] = "/css/" . $site . "_new/jquery-ui.min.js";
        $_SESSION["jquery_style_new"] = "/css/" . $site . "_new/jquery-ui.custom.css";
    }
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/css/" . $site . "_new/images/loading.gif" ) )
    {
        $_SESSION["loadingGif"] = "/css/" . $site . "_new/images/loading.gif";
    }*/

    Route::get( '/admin/login', [ BackendController::class, 'create' ] )->name( 'login' );
    Route::post( '/admin/login', [ BackendController::class, 'store' ] );
    Route::prefix( 'admin' )->middleware( 'auth:admin' )->group( function ()
    {
        Route::get( '/logout', [ BackendController::class, 'destroy' ] )->name( 'logout' );
        Route::view( "/index", "admin/index" );
    } );