Initial commit

This commit is contained in:
2026-05-20 18:25:15 +02:00
commit 95f0b4ff01
288 changed files with 90909 additions and 0 deletions

12
app/Models/Author.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Author extends Model
{
protected $fillable = [
'name', 'slug', 'user_id', 'website'
];
}

93
app/Models/Entry.php Normal file
View File

@@ -0,0 +1,93 @@
<?php
namespace App\Models;
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;
class Entry extends Model
{
/**
* @var string[]
*/
protected $fillable = [
'type',
'title',
'slug',
'description',
'main_image',
'state',
'featured',
'game_id',
'platform_id',
'status_id',
'version',
'release_date',
'staff_credits',
'relevant_link',
'youtube_link',
'user_id',
'complete_title',
];
/**
* @var string[]
*/
protected $casts = [
'featured' => 'boolean',
'release_date' => 'date',
];
public function scopePublished( Builder $query ): Builder {
return $query->where( 'state', 'published' );
}
/**
* Return game link.
* @return BelongsTo
*/
public function game(): BelongsTo {
return $this->belongsTo(Game::class);
}
public function platform(): BelongsTo {
return $this->belongsTo(Platform::class);
}
public function getRealPlatform(): ?Platform {
return $this->game?->platform ?? $this->platform;
}
public function status(): BelongsTo {
return $this->belongsTo(Status::class );
}
public function authors(): BelongsToMany {
return $this->belongsToMany(Author::class, 'entry_authors');
}
public function languages(): BelongsToMany {
return $this->belongsToMany(Language::class, 'entry_languages');
}
public function modifications(): BelongsToMany {
return $this->belongsToMany( Modification::class, 'entry_modifications');
}
public function files(): HasMany {
return $this->hasMany(EntryFile::class)->orderBy('filename');
}
public function gallery(): HasMany {
return $this->hasMany(EntryGallery::class)->orderBy('id');
}
public function hashes(): HasMany {
return $this->hasMany(EntryHash::class);
}
}

23
app/Models/EntryFile.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class EntryFile extends Model
{
protected $fillable = [
'entry_id', 'filename', 'filepath', 'favorite_server', 'favorite_at', 'filesize', 'state', 'file_uuid'
];
protected $casts = [
'favorite_at' => 'timestamp'
];
public function entry(): BelongsTo
{
return $this->belongsTo(Entry::class);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class EntryGallery extends Model
{
protected $fillable = ['entry_id','image'];
}

18
app/Models/EntryHash.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class EntryHash extends Model
{
protected $fillable = [
'entry_id', 'filename', 'hash_crc32', 'hash_sha1', 'verified'
];
public function entry(): BelongsTo
{
return $this->belongsTo(Entry::class);
}
}

24
app/Models/Game.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Game extends Model
{
/**
* @var string[]
*/
protected $fillable = ['name', 'slug', 'platform_id', 'genre_id' ];
public function platform(): BelongsTo
{
return $this->belongsTo(Platform::class);
}
public function genre(): BelongsTo
{
return $this->belongsTo(Genre::class);
}
}

10
app/Models/Genre.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Genre extends Model
{
protected $fillable = [ 'name', 'slug' ];
}

10
app/Models/Language.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Language extends Model
{
protected $fillable = [ 'name', 'slug' ];
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Modification extends Model
{
protected $fillable = [ 'name', 'slug' ];
}

17
app/Models/Platform.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Platform extends Model
{
/**
* @var string[]
*/
protected $fillable = [
'name', 'slug', 'short_name'
];
}

10
app/Models/Status.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Status extends Model
{
protected $fillable = ['name', 'slug'];
}

32
app/Models/User.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
#[Fillable(['name', 'email', 'password'])]
#[Hidden(['password', 'remember_token'])]
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}