A lot of things.
This commit is contained in:
@@ -2,11 +2,29 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Auth\XenForoUser;
|
||||
use App\Services\XenforoService;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Author extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name', 'slug', 'user_id', 'website'
|
||||
];
|
||||
|
||||
public function entries(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Entry::class, 'entry_authors');
|
||||
}
|
||||
|
||||
public function user(): ?XenForoUser
|
||||
{
|
||||
if( !$this->user_id )
|
||||
return null;
|
||||
|
||||
return app(XenforoService::class)->getXfUser($this->user_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class EntryFile extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'entry_id', 'filename', 'filepath', 'favorite_server', 'favorite_at', 'filesize', 'state', 'file_uuid'
|
||||
'entry_id', 'filename', 'filepath', 'favorite_server', 'favorite_at', 'filesize', 'state', 'file_uuid', 'online_patcher', 'secondary_online_patcher',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
||||
@@ -21,4 +21,9 @@ class Game extends Model
|
||||
{
|
||||
return $this->belongsTo(Genre::class);
|
||||
}
|
||||
|
||||
public function entries(): Game|\Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Entry::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,15 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Genre extends Model
|
||||
{
|
||||
protected $fillable = [ 'name', 'slug' ];
|
||||
|
||||
public function games(): HasMany
|
||||
{
|
||||
return $this->hasMany(Game::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,15 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Language extends Model
|
||||
{
|
||||
protected $fillable = [ 'name', 'slug' ];
|
||||
|
||||
public function entries(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Entry::class, 'entry_languages');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Platform extends Model
|
||||
{
|
||||
@@ -14,4 +15,13 @@ class Platform extends Model
|
||||
'name', 'slug', 'short_name'
|
||||
];
|
||||
|
||||
public function games(): HasMany
|
||||
{
|
||||
return $this->hasMany(Game::class);
|
||||
}
|
||||
|
||||
public function entries(): HasMany
|
||||
{
|
||||
return $this->hasMany(Entry::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user