From cacaa5c45279ff204dc0c248d18c850df2a674a0 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Mon, 13 May 2024 11:40:34 +0300 Subject: [PATCH] update --- .../Minecraft/App/Models/MinecraftServer.php | 34 +++++++++++++++++++ .../actions/minecraft-docker-yaml.blade.php | 9 +++++ 2 files changed, 43 insertions(+) create mode 100644 web/Modules/Minecraft/resources/views/actions/minecraft-docker-yaml.blade.php diff --git a/web/Modules/Minecraft/App/Models/MinecraftServer.php b/web/Modules/Minecraft/App/Models/MinecraftServer.php index 332fa01..f5d0e50 100644 --- a/web/Modules/Minecraft/App/Models/MinecraftServer.php +++ b/web/Modules/Minecraft/App/Models/MinecraftServer.php @@ -2,6 +2,7 @@ namespace Modules\Minecraft\App\Models; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; use Modules\Minecraft\Database\factories\MinecraftServerFactory; @@ -16,4 +17,37 @@ class MinecraftServer extends Model protected $fillable = []; + protected static function booted(): void + { + static::addGlobalScope('customer', function (Builder $query) { + if (auth()->check() && auth()->guard()->name == 'web_customer') { + $query->where('customer_id', auth()->user()->id); + } + }); + } + + + public static function boot() + { + parent::boot(); + + static::creating(function ($model) { + + + }); + + static::created(function ($model) { + + + }); + + static::deleting(function ($model) { + + + + + }); + + } + } diff --git a/web/Modules/Minecraft/resources/views/actions/minecraft-docker-yaml.blade.php b/web/Modules/Minecraft/resources/views/actions/minecraft-docker-yaml.blade.php new file mode 100644 index 0000000..d8fc544 --- /dev/null +++ b/web/Modules/Minecraft/resources/views/actions/minecraft-docker-yaml.blade.php @@ -0,0 +1,9 @@ +services: + minecraft-server: + image: itzg/minecraft-server + tty: true + stdin_open: true + ports: + - "25565:25565" + environment: + EULA: "TRUE"