Update Submissions and add fields

This commit is contained in:
2026-06-10 11:04:26 +02:00
parent 1d8ea70b72
commit 4f9f6c63b3
64 changed files with 2278 additions and 174 deletions

View File

@@ -2,17 +2,100 @@
namespace App\Models;
use App\Traits\HasGallery;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Monolog\Level;
/**
* @property int $id
* @property string $type
* @property string|null $title
* @property string|null $slug
* @property string|null $description
* @property string|null $main_image
* @property string $state
* @property string|null $staff_comment
* @property \Illuminate\Support\Carbon|null $rejected_at
* @property bool $featured
* @property int|null $game_id
* @property int|null $platform_id
* @property int|null $status_id
* @property string|null $version
* @property \Illuminate\Support\Carbon|null $release_date
* @property string|null $staff_credits
* @property string|null $relevant_link
* @property string|null $youtube_link
* @property int $user_id
* @property int|null $comments_thread_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property string|null $complete_title
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int|null $level_id
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Author> $authors
* @property-read int|null $authors_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Category> $categories
* @property-read int|null $categories_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\EntryFile> $files
* @property-read int|null $files_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Gallery> $gallery
* @property-read int|null $gallery_count
* @property-read \App\Models\Game|null $game
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\EntryHash> $hashes
* @property-read int|null $hashes_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Language> $languages
* @property-read int|null $languages_count
* @property-read \App\Models\Level|null $level
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Modification> $modifications
* @property-read int|null $modifications_count
* @property-read \App\Models\Platform|null $platform
* @property-read \App\Models\Status|null $status
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\System> $systems
* @property-read int|null $systems_count
* @method static Builder<static>|Entry inQueue(int $daysRejected = 7)
* @method static Builder<static>|Entry newModelQuery()
* @method static Builder<static>|Entry newQuery()
* @method static Builder<static>|Entry onlyTrashed()
* @method static Builder<static>|Entry published()
* @method static Builder<static>|Entry query()
* @method static Builder<static>|Entry whereCommentsThreadId($value)
* @method static Builder<static>|Entry whereCompleteTitle($value)
* @method static Builder<static>|Entry whereCreatedAt($value)
* @method static Builder<static>|Entry whereDeletedAt($value)
* @method static Builder<static>|Entry whereDescription($value)
* @method static Builder<static>|Entry whereFeatured($value)
* @method static Builder<static>|Entry whereGameId($value)
* @method static Builder<static>|Entry whereId($value)
* @method static Builder<static>|Entry whereLevelId($value)
* @method static Builder<static>|Entry whereMainImage($value)
* @method static Builder<static>|Entry wherePlatformId($value)
* @method static Builder<static>|Entry whereRejectedAt($value)
* @method static Builder<static>|Entry whereReleaseDate($value)
* @method static Builder<static>|Entry whereRelevantLink($value)
* @method static Builder<static>|Entry whereSlug($value)
* @method static Builder<static>|Entry whereStaffComment($value)
* @method static Builder<static>|Entry whereStaffCredits($value)
* @method static Builder<static>|Entry whereState($value)
* @method static Builder<static>|Entry whereStatusId($value)
* @method static Builder<static>|Entry whereTitle($value)
* @method static Builder<static>|Entry whereType($value)
* @method static Builder<static>|Entry whereUpdatedAt($value)
* @method static Builder<static>|Entry whereUserId($value)
* @method static Builder<static>|Entry whereVersion($value)
* @method static Builder<static>|Entry whereYoutubeLink($value)
* @method static Builder<static>|Entry withTrashed(bool $withTrashed = true)
* @method static Builder<static>|Entry withoutTrashed()
* @mixin \Eloquent
*/
class Entry extends Model
{
use SoftDeletes;
use SoftDeletes, HasGallery;
/**
* @var string[]
@@ -38,6 +121,7 @@ class Entry extends Model
'comments_thread_id',
'staff_comment',
'rejected_at',
'level_id'
];
/**
@@ -81,6 +165,10 @@ class Entry extends Model
return $this->belongsTo(Status::class );
}
public function level(): BelongsTo {
return $this->belongsTo(\App\Models\Level::class);
}
public function authors(): BelongsToMany {
return $this->belongsToMany(Author::class, 'entry_authors');
}
@@ -93,12 +181,16 @@ class Entry extends Model
return $this->belongsToMany( Modification::class, 'entry_modifications');
}
public function files(): HasMany {
return $this->hasMany(EntryFile::class)->orderBy('filename');
public function categories(): BelongsToMany {
return $this->belongsToMany(Category::class, 'entry_categories');
}
public function gallery(): HasMany {
return $this->hasMany(EntryGallery::class)->orderBy('id');
public function systems(): BelongsToMany {
return $this->belongsToMany(System::class, 'entry_systems');
}
public function files(): HasMany {
return $this->hasMany(EntryFile::class)->orderBy('filename');
}
public function hashes(): HasMany {