From 8b87e03cbf9a41620bf08a6f618c255dea5f33f1 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Sat, 18 May 2024 00:18:27 +0200 Subject: [PATCH 1/6] laravel permissions and admin role --- app/Actions/Fortify/CreateNewUser.php | 11 +- app/Factories/PlanetServiceFactory.php | 1 + app/Http/Controllers/GalaxyController.php | 6 + app/Models/User.php | 2 + app/Services/PlayerService.php | 13 ++ composer.json | 3 +- composer.lock | 84 +++++++- config/permission.php | 186 ++++++++++++++++++ ..._05_17_213500_create_permission_tables.php | 138 +++++++++++++ .../2024_05_17_213750_add_roles.php | 44 +++++ 10 files changed, 485 insertions(+), 3 deletions(-) create mode 100644 config/permission.php create mode 100644 database/migrations/2024_05_17_213500_create_permission_tables.php create mode 100644 database/migrations/2024_05_17_213750_add_roles.php diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index 8eaf6661..5a8b0169 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -138,11 +138,20 @@ public function create(array $input): User 'password' => $this->passwordRules(), ])->validate(); - return User::create([ + $user = User::create([ 'lang' => 'en', 'username' => $this->generateUniqueName(), 'email' => $input['email'], 'password' => Hash::make($input['password']), ]); + + // Check if the user is the first registered user + if (User::count() === 1) { + $user->assignRole('admin'); + $user->username = 'Admin'; + $user->save(); + } + + return $user; } } diff --git a/app/Factories/PlanetServiceFactory.php b/app/Factories/PlanetServiceFactory.php index aabc5a38..862a766f 100644 --- a/app/Factories/PlanetServiceFactory.php +++ b/app/Factories/PlanetServiceFactory.php @@ -6,6 +6,7 @@ use Illuminate\Support\Carbon; use OGame\Models\Planet; use OGame\Models\Planet\Coordinate; +use OGame\Models\User; use OGame\Services\PlanetService; use OGame\Services\PlayerService; use OGame\Services\SettingsService; diff --git a/app/Http/Controllers/GalaxyController.php b/app/Http/Controllers/GalaxyController.php index 193d57f8..8c9aa915 100644 --- a/app/Http/Controllers/GalaxyController.php +++ b/app/Http/Controllers/GalaxyController.php @@ -73,6 +73,10 @@ public function getGalaxyArray(int $galaxy, int $system, PlayerService $player, // Planet with player $planet = $planets[$i]; $player = $planet->getPlayer(); + $nameAbbreviations = []; + if ($player->isAdmin()) { + $nameAbbreviations[] = 'admin'; + } $galaxy_rows[] = [ 'actions' => [ 'canBeIgnored' => false, @@ -126,6 +130,8 @@ public function getGalaxyArray(int $galaxy, int $system, PlayerService $player, ], 'playerId' => $player->getId(), 'playerName' => $player->getUsername(), + 'nameAbbreviations' => $nameAbbreviations, + 'isAdmin' => $player->isAdmin(), //'allianceId' => 1, //'allianceName' => 'Test', ], diff --git a/app/Models/User.php b/app/Models/User.php index 05a516ff..eb85dd73 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Spatie\Permission\Traits\HasRoles; /** * @@ -53,6 +54,7 @@ class User extends Authenticatable { use Notifiable; use HasFactory; + use HasRoles; /** * Disable use of default "remember_token" laravel behavior. diff --git a/app/Services/PlayerService.php b/app/Services/PlayerService.php index 095e57bc..4aca2d30 100644 --- a/app/Services/PlayerService.php +++ b/app/Services/PlayerService.php @@ -144,6 +144,16 @@ public function save(): void $this->user->save(); } + /** + * Checks if the player is an admin. + * + * @return bool + */ + public function isAdmin(): bool + { + return $this->user->hasRole('admin'); + } + /** * Set username property. * @@ -177,6 +187,9 @@ public function validateUsername(string $username): false|int */ public function getUsername(): string { + if ($this->isAdmin()) { + return '' . $this->user->username . ''; + } return $this->user->username; } diff --git a/composer.json b/composer.json index ecfb167a..cb67aa2b 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "laravel/fortify": "^1.21", "laravel/framework": "^11.0", "laravel/tinker": "^2.9", - "laravel/ui": "^4.5" + "laravel/ui": "^4.5", + "spatie/laravel-permission": "^6.7" }, "require-dev": { "barryvdh/laravel-debugbar": "^3.13", diff --git a/composer.lock b/composer.lock index 9a9bdb86..427ba939 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a5cd9d615c51ce520ec9818c1c06ecc5", + "content-hash": "c44fdaeffe30406550d792f92d0fcbfb", "packages": [ { "name": "bacon/bacon-qr-code", @@ -3475,6 +3475,88 @@ ], "time": "2024-04-27T21:32:50+00:00" }, + { + "name": "spatie/laravel-permission", + "version": "6.7.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-permission.git", + "reference": "17607924aa0aa89bc0153c2ce45ed7c55083367b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/17607924aa0aa89bc0153c2ce45ed7c55083367b", + "reference": "17607924aa0aa89bc0153c2ce45ed7c55083367b", + "shasum": "" + }, + "require": { + "illuminate/auth": "^8.12|^9.0|^10.0|^11.0", + "illuminate/container": "^8.12|^9.0|^10.0|^11.0", + "illuminate/contracts": "^8.12|^9.0|^10.0|^11.0", + "illuminate/database": "^8.12|^9.0|^10.0|^11.0", + "php": "^8.0" + }, + "require-dev": { + "laravel/passport": "^11.0|^12.0", + "orchestra/testbench": "^6.23|^7.0|^8.0|^9.0", + "phpunit/phpunit": "^9.4|^10.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.x-dev", + "dev-master": "6.x-dev" + }, + "laravel": { + "providers": [ + "Spatie\\Permission\\PermissionServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\Permission\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Permission handling for Laravel 8.0 and up", + "homepage": "https://github.com/spatie/laravel-permission", + "keywords": [ + "acl", + "laravel", + "permission", + "permissions", + "rbac", + "roles", + "security", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-permission/issues", + "source": "https://github.com/spatie/laravel-permission/tree/6.7.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2024-04-19T12:35:28+00:00" + }, { "name": "symfony/clock", "version": "v7.0.7", diff --git a/config/permission.php b/config/permission.php new file mode 100644 index 00000000..2a520f35 --- /dev/null +++ b/config/permission.php @@ -0,0 +1,186 @@ + [ + + /* + * When using the "HasPermissions" trait from this package, we need to know which + * Eloquent model should be used to retrieve your permissions. Of course, it + * is often just the "Permission" model but you may use whatever you like. + * + * The model you want to use as a Permission model needs to implement the + * `Spatie\Permission\Contracts\Permission` contract. + */ + + 'permission' => Spatie\Permission\Models\Permission::class, + + /* + * When using the "HasRoles" trait from this package, we need to know which + * Eloquent model should be used to retrieve your roles. Of course, it + * is often just the "Role" model but you may use whatever you like. + * + * The model you want to use as a Role model needs to implement the + * `Spatie\Permission\Contracts\Role` contract. + */ + + 'role' => Spatie\Permission\Models\Role::class, + + ], + + 'table_names' => [ + + /* + * When using the "HasRoles" trait from this package, we need to know which + * table should be used to retrieve your roles. We have chosen a basic + * default value but you may easily change it to any table you like. + */ + + 'roles' => 'roles', + + /* + * When using the "HasPermissions" trait from this package, we need to know which + * table should be used to retrieve your permissions. We have chosen a basic + * default value but you may easily change it to any table you like. + */ + + 'permissions' => 'permissions', + + /* + * When using the "HasPermissions" trait from this package, we need to know which + * table should be used to retrieve your models permissions. We have chosen a + * basic default value but you may easily change it to any table you like. + */ + + 'model_has_permissions' => 'model_has_permissions', + + /* + * When using the "HasRoles" trait from this package, we need to know which + * table should be used to retrieve your models roles. We have chosen a + * basic default value but you may easily change it to any table you like. + */ + + 'model_has_roles' => 'model_has_roles', + + /* + * When using the "HasRoles" trait from this package, we need to know which + * table should be used to retrieve your roles permissions. We have chosen a + * basic default value but you may easily change it to any table you like. + */ + + 'role_has_permissions' => 'role_has_permissions', + ], + + 'column_names' => [ + /* + * Change this if you want to name the related pivots other than defaults + */ + 'role_pivot_key' => null, //default 'role_id', + 'permission_pivot_key' => null, //default 'permission_id', + + /* + * Change this if you want to name the related model primary key other than + * `model_id`. + * + * For example, this would be nice if your primary keys are all UUIDs. In + * that case, name this `model_uuid`. + */ + + 'model_morph_key' => 'model_id', + + /* + * Change this if you want to use the teams feature and your related model's + * foreign key is other than `team_id`. + */ + + 'team_foreign_key' => 'team_id', + ], + + /* + * When set to true, the method for checking permissions will be registered on the gate. + * Set this to false if you want to implement custom logic for checking permissions. + */ + + 'register_permission_check_method' => true, + + /* + * When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered + * this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated + * NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it. + */ + 'register_octane_reset_listener' => false, + + /* + * Teams Feature. + * When set to true the package implements teams using the 'team_foreign_key'. + * If you want the migrations to register the 'team_foreign_key', you must + * set this to true before doing the migration. + * If you already did the migration then you must make a new migration to also + * add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions' + * (view the latest version of this package's migration file) + */ + + 'teams' => false, + + /* + * Passport Client Credentials Grant + * When set to true the package will use Passports Client to check permissions + */ + + 'use_passport_client_credentials' => false, + + /* + * When set to true, the required permission names are added to exception messages. + * This could be considered an information leak in some contexts, so the default + * setting is false here for optimum safety. + */ + + 'display_permission_in_exception' => false, + + /* + * When set to true, the required role names are added to exception messages. + * This could be considered an information leak in some contexts, so the default + * setting is false here for optimum safety. + */ + + 'display_role_in_exception' => false, + + /* + * By default wildcard permission lookups are disabled. + * See documentation to understand supported syntax. + */ + + 'enable_wildcard_permission' => false, + + /* + * The class to use for interpreting wildcard permissions. + * If you need to modify delimiters, override the class and specify its name here. + */ + // 'permission.wildcard_permission' => Spatie\Permission\WildcardPermission::class, + + /* Cache-specific settings */ + + 'cache' => [ + + /* + * By default all permissions are cached for 24 hours to speed up performance. + * When permissions or roles are updated the cache is flushed automatically. + */ + + 'expiration_time' => \DateInterval::createFromDateString('24 hours'), + + /* + * The cache key used to store all permissions. + */ + + 'key' => 'spatie.permission.cache', + + /* + * You may optionally indicate a specific cache driver to use for permission and + * role caching using any of the `store` drivers listed in the cache.php config + * file. Using 'default' here means to use the `default` set in cache.php. + */ + + 'store' => 'default', + ], +]; diff --git a/database/migrations/2024_05_17_213500_create_permission_tables.php b/database/migrations/2024_05_17_213500_create_permission_tables.php new file mode 100644 index 00000000..b865d480 --- /dev/null +++ b/database/migrations/2024_05_17_213500_create_permission_tables.php @@ -0,0 +1,138 @@ +bigIncrements('id'); // permission id + $table->string('name'); // For MySQL 8.0 use string('name', 125); + $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125); + $table->timestamps(); + + $table->unique(['name', 'guard_name']); + }); + + Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) { + $table->bigIncrements('id'); // role id + if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing + $table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable(); + $table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index'); + } + $table->string('name'); // For MySQL 8.0 use string('name', 125); + $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125); + $table->timestamps(); + if ($teams || config('permission.testing')) { + $table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']); + } else { + $table->unique(['name', 'guard_name']); + } + }); + + Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) { + $table->unsignedBigInteger($pivotPermission); + + $table->string('model_type'); + $table->unsignedBigInteger($columnNames['model_morph_key']); + $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index'); + + $table->foreign($pivotPermission) + ->references('id') // permission id + ->on($tableNames['permissions']) + ->onDelete('cascade'); + if ($teams) { + $table->unsignedBigInteger($columnNames['team_foreign_key']); + $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); + + $table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary'); + } else { + $table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary'); + } + + }); + + Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) { + $table->unsignedBigInteger($pivotRole); + + $table->string('model_type'); + $table->unsignedBigInteger($columnNames['model_morph_key']); + $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index'); + + $table->foreign($pivotRole) + ->references('id') // role id + ->on($tableNames['roles']) + ->onDelete('cascade'); + if ($teams) { + $table->unsignedBigInteger($columnNames['team_foreign_key']); + $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index'); + + $table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary'); + } else { + $table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary'); + } + }); + + Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) { + $table->unsignedBigInteger($pivotPermission); + $table->unsignedBigInteger($pivotRole); + + $table->foreign($pivotPermission) + ->references('id') // permission id + ->on($tableNames['permissions']) + ->onDelete('cascade'); + + $table->foreign($pivotRole) + ->references('id') // role id + ->on($tableNames['roles']) + ->onDelete('cascade'); + + $table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary'); + }); + + app('cache') + ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) + ->forget(config('permission.cache.key')); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $tableNames = config('permission.table_names'); + + if (empty($tableNames)) { + throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); + } + + Schema::drop($tableNames['role_has_permissions']); + Schema::drop($tableNames['model_has_roles']); + Schema::drop($tableNames['model_has_permissions']); + Schema::drop($tableNames['roles']); + Schema::drop($tableNames['permissions']); + } +}; diff --git a/database/migrations/2024_05_17_213750_add_roles.php b/database/migrations/2024_05_17_213750_add_roles.php new file mode 100644 index 00000000..979c92c0 --- /dev/null +++ b/database/migrations/2024_05_17_213750_add_roles.php @@ -0,0 +1,44 @@ + 'admin']); + Role::create(['name' => 'moderator']); + Role::create(['name' => 'player']); + + // Assign "admin" role to the first user and rename it to "Admin". + $firstUser = User::first(); + if ($firstUser) { + $firstUser->assignRole('admin'); + $firstUser->username = 'Admin'; + $firstUser->save(); + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // Remove roles from the first user + $firstUser = User::first(); + if ($firstUser) { + $firstUser->removeRole('admin'); + } + + Role::where('name', 'admin')->delete(); + Role::where('name', 'moderator')->delete(); + Role::where('name', 'player')->delete(); + } +}; From 48842100830070f7f17f6cd04c3da44b490bfe35 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Sat, 18 May 2024 01:46:38 +0200 Subject: [PATCH 2/6] Add admin menu bar and navigation --- .../Admin/ServerSettingsController.php | 24 +++ app/Http/Controllers/BuddiesController.php | 1 - app/Http/Kernel.php | 2 + app/Http/Middleware/Admin.php | 29 +++ bootstrap/app.php | 2 + public/img/admin/admin-menu-bg.jpg | Bin 0 -> 1244 bytes .../ingame/admin/serversettings.blade.php | 35 +++ .../views/ingame/buddies/index.blade.php | 2 +- .../views/ingame/layouts/admin-menu.blade.php | 74 +++++++ resources/views/ingame/layouts/main.blade.php | 204 +++++++----------- .../views/ingame/premium/index.blade.php | 3 +- routes/web.php | 9 +- 12 files changed, 258 insertions(+), 127 deletions(-) create mode 100644 app/Http/Controllers/Admin/ServerSettingsController.php create mode 100644 app/Http/Middleware/Admin.php create mode 100644 public/img/admin/admin-menu-bg.jpg create mode 100644 resources/views/ingame/admin/serversettings.blade.php create mode 100644 resources/views/ingame/layouts/admin-menu.blade.php diff --git a/app/Http/Controllers/Admin/ServerSettingsController.php b/app/Http/Controllers/Admin/ServerSettingsController.php new file mode 100644 index 00000000..dbdb5ce5 --- /dev/null +++ b/app/Http/Controllers/Admin/ServerSettingsController.php @@ -0,0 +1,24 @@ +with([ + 'username' => $player->getUsername(), + 'current_email' => $player->getEmail(), + ]); + } +} diff --git a/app/Http/Controllers/BuddiesController.php b/app/Http/Controllers/BuddiesController.php index 6021e2a5..2bdd9f2b 100644 --- a/app/Http/Controllers/BuddiesController.php +++ b/app/Http/Controllers/BuddiesController.php @@ -13,7 +13,6 @@ class BuddiesController extends OGameController */ public function index(): View { - $this->setBodyId('buddies'); return view('ingame.buddies.index'); } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 7c950190..00a10026 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -18,6 +18,7 @@ use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Session\Middleware\StartSession; use Illuminate\View\Middleware\ShareErrorsFromSession; +use OGame\Http\Middleware\Admin; use OGame\Http\Middleware\GlobalGame; use OGame\Http\Middleware\Locale; use OGame\Http\Middleware\RedirectIfAuthenticated; @@ -75,5 +76,6 @@ class Kernel extends HttpKernel 'throttle' => ThrottleRequests::class, 'globalgame' => GlobalGame::class, 'locale' => Locale::class, + 'admin' => Admin::class, ]; } diff --git a/app/Http/Middleware/Admin.php b/app/Http/Middleware/Admin.php new file mode 100644 index 00000000..2d369b77 --- /dev/null +++ b/app/Http/Middleware/Admin.php @@ -0,0 +1,29 @@ +hasRole('admin')) { + return redirect('/overview'); + } + } + + return $next($request); + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 30501592..dc9b5030 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -3,6 +3,7 @@ use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; +use OGame\Http\Middleware\Admin; use OGame\Http\Middleware\GlobalGame; use OGame\Http\Middleware\Locale; @@ -17,6 +18,7 @@ $middleware->alias([ 'globalgame' => GlobalGame::class, 'locale' => Locale::class, + 'admin' => Admin::class, ]); }) ->withExceptions(function (Exceptions $exceptions) { diff --git a/public/img/admin/admin-menu-bg.jpg b/public/img/admin/admin-menu-bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e6a35a052bf0914e6ccf3e735dbb050baea598ec GIT binary patch literal 1244 zcmaJ>O-$546rOIoKO_sGf{GW@lmklK{_U>Nh84*!tHcy>S)vCIcH03O=#Onz7Q7h4 zg(Jp9FCM&OycjPWB*qvOJ)kitdLi+^fv5+MCUv^(@{_Q>q|-NVzVCZ)W?t)m@i#%o zU_~DXU}&ft#K4~U+kniK)u~y40Rn{!0Qj3YKk0e4#ImN#D4JD*jA|KdMX_0);aJeu zU$GT+3VKutPUvQa{jN}r(w zPDrx6!1Cz?&q*mkO7>7SqftUf8%8m*VyfYx%Qr3ZrXE{a7nyw$@$fV_2?xbZ?LYnEJPRWX@n?dAs zl_Ja1km-7gsluULhDIWcu4|H*9_&3U_9nS(R^a);yvU&;KalGYQ@yEtN~m*lmRdHT z>D9T~9yisH8#IJrqs%$z=(nJjcPxXd?po3t*TOf{t8ul)wFnKlEGmW#?snf@*F&g* z0(ZB0(PX#%p^19lLCx*|1TEE;1=Lc2Z{BWzXHe@I1ex!BSDD7a1!%h z0Ue;a_I?1!3rCtz=wOh*!;w~ig@_2g4;vzs_Tn*Y@$tvD`)i}0kSd7a`^7Nw%HrCQ zcBRmE&))!Xv=$<967+-DmljUWk3a3|eDZefwtd-ITD#MGclAb+d${oK+0w*@@uzv~ z$JTb&(e&8O}p#9lun3bN9&vXhH`!V`TA`0gU^4LkN+MWyWoHQ E2Y5hIDF6Tf literal 0 HcmV?d00001 diff --git a/resources/views/ingame/admin/serversettings.blade.php b/resources/views/ingame/admin/serversettings.blade.php new file mode 100644 index 00000000..3132bbcd --- /dev/null +++ b/resources/views/ingame/admin/serversettings.blade.php @@ -0,0 +1,35 @@ +@extends('ingame.layouts.main') + +@section('content') + + @if (session('status')) +
+ {{ session('status') }} +
+ @endif + +
+
+

Server settings

+
+ +
+
+

Server settings

+
+
+
+

Server settings here

+ +
+ + +
+
+ +
+ +@endsection diff --git a/resources/views/ingame/buddies/index.blade.php b/resources/views/ingame/buddies/index.blade.php index a9022a19..88364cf7 100644 --- a/resources/views/ingame/buddies/index.blade.php +++ b/resources/views/ingame/buddies/index.blade.php @@ -8,7 +8,7 @@ @endif -
+

Buddies

diff --git a/resources/views/ingame/layouts/admin-menu.blade.php b/resources/views/ingame/layouts/admin-menu.blade.php new file mode 100644 index 00000000..92a96fb1 --- /dev/null +++ b/resources/views/ingame/layouts/admin-menu.blade.php @@ -0,0 +1,74 @@ +@php /** @var OGame\Services\PlayerService $currentPlayer */ @endphp +
+ +
+ + +
+
diff --git a/resources/views/ingame/layouts/main.blade.php b/resources/views/ingame/layouts/main.blade.php index ea35bcfd..4721b05b 100644 --- a/resources/views/ingame/layouts/main.blade.php +++ b/resources/views/ingame/layouts/main.blade.php @@ -70,6 +70,9 @@
Have fun playing!
+@if ($currentPlayer->isAdmin()) + @include ('ingame.layouts.admin-menu', ['currentPlayer' => $currentPlayer]) +@endif
+ +
@@ -1122,47 +1123,6 @@ function initChatAsync() {
- +
+ +@endsection diff --git a/resources/views/ingame/admin/serversettings.blade.php b/resources/views/ingame/admin/serversettings.blade.php index 3132bbcd..210085bf 100644 --- a/resources/views/ingame/admin/serversettings.blade.php +++ b/resources/views/ingame/admin/serversettings.blade.php @@ -8,7 +8,7 @@
@endif -
+

Server settings

@@ -17,14 +17,70 @@

Server settings

-
-
-

Server settings here

- -
+
+ {{ csrf_field() }} +
+
+

@lang('You can change the server settings below. Changes will be applied immediately.')

- -
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +

@lang('Note: basic income values below are multiplied by economy speed.')

+ +
+
+ +
+ (= {{ \OGame\Facades\AppUtil::formatNumber($basic_income_metal * $economy_speed) }}) +
+
+
+ +
+ (= {{ \OGame\Facades\AppUtil::formatNumber($basic_income_crystal * $economy_speed) }}) +
+
+
+ +
+ (= {{ \OGame\Facades\AppUtil::formatNumber($basic_income_deuterium * $economy_speed) }}) +
+
+
+ +
+ (= {{ \OGame\Facades\AppUtil::formatNumber($basic_income_energy * $economy_speed) }}) +
+
+
+
+ + +
+
diff --git a/resources/views/outgame/layouts/main.blade.php b/resources/views/outgame/layouts/main.blade.php index c5634c47..d5a1d921 100644 --- a/resources/views/outgame/layouts/main.blade.php +++ b/resources/views/outgame/layouts/main.blade.php @@ -1,5 +1,4 @@ - - + + This application is released under the MIT License. For more details, visit the GitHub repository. +--> - - - - - - - - - - - + + + + + + + + + + + {{ config('app.name', 'Laravel') }} @@ -39,74 +40,92 @@ @@ -123,14 +142,18 @@

Your browser is not up to date.

-

Your Internet Explorer version does not correspond to the existing standards and is not supported by this website anymore.

-

To use this website please update your web browser to a current version or use another web browser. If you are already using the latest version, please reload the page to display it properly.

-

Here`s a list of the most popular browsers. Click on one of the symbols to get to the download page:

+

Your Internet Explorer version does not correspond to the existing standards and is not + supported by this website anymore.

+

To use this website please update your web browser to a current version or use another web + browser. If you are already using the latest version, please reload the page to display it properly.

+

Here`s a list of the most popular browsers. Click on one of the symbols to get to the download + page:

@@ -143,10 +166,10 @@
@@ -180,7 +206,7 @@
+ Universe:
- + Forgot your password? -
- Forgot your email address? -

- With the login I accept the T&Cs

+
+ Forgot your email + address? +

+ With the login I accept the T&Cs

@@ -209,14 +236,14 @@ class="" autocomplete="off" > {{ csrf_field() }} - - + + - - - - - + + + + +

PLAY FOR FREE!

@@ -430,9 +457,12 @@ class="server-row exodus-server-normal uni_span margin-uni-selection"
-->
- + @if ($errors->has('email')) @@ -445,7 +475,7 @@ class="server-row exodus-server-normal uni_span margin-uni-selection" @endif
- +
Legal | Privacy Policy | T&Cs | - Contact | - Rules + Contact | + Rules
+ + + + + + +
+
@@ -493,15 +528,89 @@ class="server-row exodus-server-normal uni_span margin-uni-selection" var text_age_check_failed = "We are sorry, but you are not eligible to register. Please see our T&C for more information.";