Commit f3e093f8 authored by Kbida Vincent's avatar Kbida Vincent

début des requêtes du tp 2

parent 9f8b3279
......@@ -7,6 +7,7 @@ use bdd\models\Game;
use bdd\models\Platform;
use bdd\models\Character;
use bdd\models\Game2character;
use bdd\models\Game_publisher;
use bdd\views\RequeteView;
class ControleurRequete{
......@@ -44,8 +45,33 @@ class ControleurRequete{
}
public function selectChar(){
$data = Game2character::select('charactter_id')->where('game_id','=','12342');
$data = Character::join('game2character','character.id','=','game2character.character_id')
->select('id','deck')
->where('game2character.game_id','=','12342');
$vue = new RequeteView($data);
$vue->render(1);
}
public function selectCharMario(){
$data = Character::join('game2character','character.id','=','game2character.character_id')
->join('game','game2character.game_id','=','game.id')
->select('id')
->where('game.name','LIKE','Mario%');
$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%');
$vue = new RequeteView($data);
$vue->render(1);
}
}
\ No newline at end of file
<?php
namespace bdd\models;
class Game_publisher extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'game_publisher';
protected $primaryKey = 'game_id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\game_publisher', 'game_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