Core implementation: controllers, views, routes, models, import command
This commit is contained in:
@@ -3,8 +3,14 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Company extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = ['igdb_id', 'name', 'slug'];
|
||||
|
||||
public function games(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Game::class, 'game_company')->withPivot('role');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class GameScreenshot extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = ['game_id', 'url', 'thumb_url', 'order'];
|
||||
|
||||
public function game(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Game::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Genre extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = ['igdb_id', 'name', 'slug'];
|
||||
|
||||
public function games(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Game::class, 'game_genre');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Platform extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = ['igdb_id', 'name', 'slug', 'abbreviation'];
|
||||
|
||||
public function games(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Game::class, 'game_platform');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user