🆙 Add fixed cms 🆙

This commit is contained in:
Remco
2026-02-02 19:30:21 +01:00
parent b1a2cab62d
commit b67e0ec2b9
3982 changed files with 193682 additions and 0 deletions
@@ -0,0 +1,38 @@
<?php
namespace App\Models\Community\RareValue;
use App\Models\Game\Furniture\CatalogItem;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class WebsiteRareValue extends Model
{
protected $guarded = ['id', 'created_at', 'updated_at'];
protected function casts()
{
return [
'currency_type' => 'integer',
];
}
public function category(): BelongsTo
{
return $this->belongsTo(WebsiteRareValueCategory::class, 'category_id');
}
public function item(): BelongsTo
{
return $this->belongsTo(CatalogItem::class, 'item_id', 'item_ids');
}
public function isLimitedEdition(): bool
{
if (is_null($this->item)) {
return false;
}
return $this->item->limited_stack > 0;
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Models\Community\RareValue;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class WebsiteRareValueCategory extends Model
{
protected $guarded = ['id', 'created_at', 'updated_at'];
public function furniture(): HasMany
{
return $this->hasMany(WebsiteRareValue::class, 'category_id');
}
}
@@ -0,0 +1,62 @@
<?php
namespace App\Models\Community\Staff;
use App\Models\Community\Teams\WebsiteTeam;
use App\Models\Game\Permission;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class WebsiteOpenPosition extends Model
{
use HasFactory;
protected $table = 'website_open_positions';
protected $guarded = ['id'];
protected $fillable = [
'position_kind',
'permission_id',
'team_id',
'description',
'apply_from',
'apply_to',
];
protected $casts = [
'apply_from' => 'datetime',
'apply_to' => 'datetime',
];
protected static function boot()
{
parent::boot();
static::deleting(function ($openPosition) {
if ($openPosition->position_kind === 'rank' && $openPosition->permission_id) {
WebsiteStaffApplications::where('rank_id', $openPosition->permission_id)->delete();
}
});
}
public function permission()
{
return $this->belongsTo(Permission::class, 'permission_id', 'id');
}
public function team()
{
return $this->belongsTo(WebsiteTeam::class, 'team_id', 'id');
}
public function applications()
{
return $this->hasMany(WebsiteStaffApplications::class, 'rank_id', 'permission_id');
}
public function scopeCanApply($query)
{
return $query->where('apply_from', '<=', now())->where('apply_to', '>', now());
}
}
@@ -0,0 +1,58 @@
<?php
namespace App\Models\Community\Staff;
use App\Models\Community\Teams\WebsiteTeam; // <-- adjust if your class lives elsewhere
use App\Models\Game\Permission;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class WebsiteStaffApplications extends Model
{
protected $table = 'website_staff_applications';
protected $guarded = ['id'];
protected $fillable = [
'user_id',
'rank_id',
'team_id',
'content',
'status',
'approved_by',
'approved_at',
'rejected_by',
'rejected_at',
];
protected $casts = [
'approved_at' => 'datetime',
'rejected_at' => 'datetime',
];
public function approver(): BelongsTo
{
return $this->belongsTo(\App\Models\User::class, 'approved_by');
}
public function rejector(): BelongsTo
{
return $this->belongsTo(\App\Models\User::class, 'rejected_by');
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
public function rank(): BelongsTo
{
return $this->belongsTo(Permission::class, 'rank_id');
}
public function team(): BelongsTo
{
return $this->belongsTo(WebsiteTeam::class, 'team_id');
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Models\Community\Staff;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class WebsiteTeam extends Model
{
protected $guarded = [];
public function users(): HasMany
{
return $this->hasMany(User::class, 'team_id', 'id');
}
public function getBadgePath(): string
{
return sprintf('%s%s.gif', setting('badges_path'), $this->getBadgeName());
}
public function getBadgeName(): string
{
return $this->badge ?: '';
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Models\Community\Teams;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class WebsiteTeam extends Model
{
protected $table = 'website_teams';
protected $guarded = ['id'];
protected $fillable = [
'rank_name',
'hidden_rank',
'badge',
'job_description',
'staff_color',
'staff_background',
];
public function users(): HasMany
{
return $this->hasMany(User::class, 'team_id', 'id');
}
public function openPositions(): HasMany
{
return $this->hasMany(\App\Models\Community\Staff\WebsiteOpenPosition::class, 'team_id', 'id');
}
public function scopeVisible($query)
{
return $query->where('hidden_rank', false);
}
}