| 964 |
lars |
1 |
<?php
|
|
|
2 |
|
| 992 |
lars |
3 |
use App\Http\Controllers\BackendController;
|
| 1118 |
lars |
4 |
use App\Http\Controllers\ToolboxController;
|
| 1093 |
lars |
5 |
use App\Models\Module;
|
| 1106 |
lars |
6 |
use App\Models\UserProperty;
|
| 1071 |
lars |
7 |
use App\Models\Web;
|
| 1076 |
lars |
8 |
use App\Models\WebProperty;
|
| 1107 |
lars |
9 |
use Illuminate\Support\Facades\Auth;
|
| 964 |
lars |
10 |
use Illuminate\Support\Facades\Route;
|
|
|
11 |
|
| 1071 |
lars |
12 |
$w = new Web();
|
|
|
13 |
$GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
|
|
|
14 |
\View::share( "web", $GLOBALS["web"] );
|
| 1100 |
lars |
15 |
$webRechte = WebProperty::with( [ "property", "property.tool", "property.tool.module" ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
|
| 1107 |
lars |
16 |
$navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
|
| 1092 |
lars |
17 |
\View::share( "navi", $navi );
|
| 1087 |
lars |
18 |
foreach ( $webRechte as $web_recht )
|
| 1081 |
lars |
19 |
{
|
| 1087 |
lars |
20 |
$property = $web_recht->property;
|
|
|
21 |
$tool = $property->tool;
|
|
|
22 |
$module = $tool->module;
|
| 1113 |
lars |
23 |
$GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
|
| 1081 |
lars |
24 |
}
|
| 1088 |
lars |
25 |
\View::share( "web_rechte", $GLOBALS["web_rechte"] );
|
| 1110 |
lars |
26 |
if ( isset( $_SESSION["admin"]["uid"] ) )
|
| 1106 |
lars |
27 |
{
|
| 1110 |
lars |
28 |
$uId = $_SESSION["admin"]["uid"];
|
| 1108 |
lars |
29 |
$admin = $_SESSION["admin"]["user"]->admin;
|
|
|
30 |
$user_rechte = $GLOBALS["web_rechte"];
|
|
|
31 |
if ( !$admin )
|
|
|
32 |
{
|
|
|
33 |
$user_rechte = UserProperty::with( [ "property", "tool", "module" ] )->where( "backend_user_id", "=", $uId )->get();
|
|
|
34 |
}
|
| 1109 |
lars |
35 |
\View::share( "user_rechte", $user_rechte );
|
| 1106 |
lars |
36 |
}
|
| 1071 |
lars |
37 |
|
| 1148 |
lars |
38 |
Route::get( '/login', [ BackendController::class, 'create' ] )->name( 'login' );
|
|
|
39 |
Route::post( '/login', [ BackendController::class, 'store' ] );
|
| 1146 |
lars |
40 |
Route::middleware( 'auth:admin' )->group( function ()
|
| 964 |
lars |
41 |
{
|
| 1027 |
lars |
42 |
Route::get( '/logout', [ BackendController::class, 'destroy' ] )->name( 'logout' );
|
| 1117 |
lars |
43 |
Route::prefix( "/toolbox" )->group( function ()
|
|
|
44 |
{
|
|
|
45 |
Route::get( "/", [ ToolboxController::class, "create" ] );
|
| 1122 |
lars |
46 |
Route::get("/changeShopVersion",[ ToolboxController::class, "changeShopVersion" ]);
|
| 1117 |
lars |
47 |
} );
|
| 1143 |
lars |
48 |
Route::view( "/", "admin/index" );
|
| 965 |
lars |
49 |
} );
|