32 lines
664 B
PHP
32 lines
664 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Models\Author;
|
|
use App\Models\Language;
|
|
use App\Models\Tag;
|
|
use App\Models\Platform;
|
|
|
|
class Game extends Model
|
|
{
|
|
protected $table = 'games';
|
|
public $guarded = ['id'];
|
|
|
|
public function authors() {
|
|
return $this->belongsToMany(Author::class, 'authors_games');
|
|
}
|
|
|
|
public function languages() {
|
|
return $this->belongsToMany(Language::class, 'languages_games');
|
|
}
|
|
|
|
public function tags() {
|
|
return $this->belongsToMany(Tag::class, 'tags_games');
|
|
}
|
|
|
|
public function platforms() {
|
|
return $this->belongsToMany(Platform::class, 'games_platforms', 'game_id', 'platform_id');
|
|
}
|
|
}
|