Skip to content
Snippets Groups Projects
Commit 7ef958b3 authored by SASSU Thomas's avatar SASSU Thomas
Browse files

associations

parent 11ffccbc
Branches
No related tags found
No related merge requests found
<?php
namespace gp\modeles;
class Client extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'client';
protected $primaryKey = 'idCli';
public $timestamps = false ;
}
\ No newline at end of file
......@@ -5,4 +5,8 @@ class Company extends \Illuminate\Database\Eloquent\Model
protected $table = 'company';
protected $primaryKey='id';
public $timestamps = false;
function games(){
return $this->BelongsToMany('gp\modeles\Game', 'game2company','company_id');
}
}
<?php
namespace gp\modeles;
class Game_rating extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'game_rating';
protected $primaryKey ='id';
public $timestamps = false;
function games(){
return $this->BelongsToMany('gp\modeles\Game', 'game2rating','rating_id');
}
function rating_board(){
return $this->BelongsTo('gp\modeles\Rating_board', 'id');
}
}
......@@ -6,4 +6,8 @@ class Genre extends \Illuminate\Database\Eloquent\Model
protected $table = 'genre';
protected $primaryKey = 'id';
public $timestamps = false ;
function games(){
return $this->BelongsToMany('gp\modeles\Game', 'game2genre','genre_id');
}
}
\ No newline at end of file
......@@ -6,4 +6,8 @@ class Platform extends \Illuminate\Database\Eloquent\Model
protected $table = 'platform';
protected $primaryKey = 'id';
public $timestamps = false ;
function games(){
return $this->BelongsToMany('gp\modeles\Game', 'game2platform','platform_id');
}
}
\ No newline at end of file
<?php
namespace gp\modeles;
class Rating_board extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'rating_board';
protected $primaryKey ='id';
public $timestamps = false;
function rating_board(){
return $this->hasMany('gp\modeles\Game_rating', 'id');
}
}
\ No newline at end of file
......@@ -5,4 +5,8 @@ class Theme extends \Illuminate\Database\Eloquent\Model
protected $table = 'theme';
protected $primaryKey ='id';
public $timestamps = false;
function games(){
return $this->BelongsToMany('gp\modeles\Game', 'game2theme','theme_id');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment