This commit is contained in:
Bozhidar 2024-05-13 11:40:34 +03:00
parent 996b219ed6
commit cacaa5c452
2 changed files with 43 additions and 0 deletions

View file

@ -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) {
});
}
}

View file

@ -0,0 +1,9 @@
services:
minecraft-server:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:
EULA: "TRUE"