Commit 26cbd7b3 authored by Loïc's avatar Loïc

Validation des 3 premières requettes

parent d9dcced4
......@@ -5,9 +5,9 @@ namespace bdd\controllers;
use bdd\models\Company;
use bdd\models\Game;
use bdd\models\Platform;
use bdd\models\Character;
use bdd\models\Perso;
use bdd\models\Game2character;
use bdd\models\Game_publisher;
use bdd\models\Game_publishers;
use bdd\views\RequeteView;
class ControleurRequete{
......@@ -45,29 +45,29 @@ class ControleurRequete{
}
public function selectChar(){
$data = Character::join('game2character','character.id','=','game2character.character_id')
->select('id','deck')
->where('game2character.game_id','=','12342');
$data = Perso::select('id','deck')
->join('game2character','perso.id','=','game2character.character_id')
->where('game2character.game_id','=','12342')->get();
$vue = new RequeteView($data);
$vue->render(1);
}
public function selectCharMario(){
$data = Character::join('game2character','character.id','=','game2character.character_id')
$data = Perso::join('game2character','perso.id','=','game2character.character_id')
->join('game','game2character.game_id','=','game.id')
->select('id')
->where('game.name','LIKE','Mario%');
->select('perso.id')
->where('game.name','LIKE','Mario%')->get();
$vue = new RequeteView($data);
$vue->render(1);
}
public function gameCompanySony(){
$data = Game::join('game_publisher','game.id','=','game_publisher.game_id')
->join('company','game_publisher.comp_id','=','company.id')
->select('id')
->where('company.name','LIKE','%Sony%');
$data = Game::join('game_publishers','game.id','=','game_publishers.game_id')
->join('company','game_publishers.comp_id','=','company.id')
->select('game.id','game.name')
->where('company.name','LIKE','%Sony%')->get();
$vue = new RequeteView($data);
$vue->render(1);
......
......@@ -2,13 +2,13 @@
namespace bdd\models;
class Game_publisher extends \Illuminate\Database\Eloquent\Model
class Game_publishers extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'game_publisher';
protected $table = 'game_publishers';
protected $primaryKey = 'game_id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\game_publisher', 'game_id');
return $this->belongsTo('bdd\models\game_publishers', 'game_id');
}
}
\ No newline at end of file
......@@ -2,13 +2,13 @@
namespace bdd\models;
class Character extends \Illuminate\Database\Eloquent\Model
class Perso extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'character';
protected $table = 'perso';
protected $primaryKey = 'id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\character', 'id');
return $this->belongsTo('bdd\models\perso', 'id');
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment