Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SCHULER_VISENTINI_KBIDA_TARDIEU_BDD_Applications_S4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SCHULER Killian
SCHULER_VISENTINI_KBIDA_TARDIEU_BDD_Applications_S4
Commits
26cbd7b3
Commit
26cbd7b3
authored
Mar 11, 2020
by
Loïc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validation des 3 premières requettes
parent
d9dcced4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
12 deletions
+40
-12
tp2/src/controllers/ControleurRequete.php
tp2/src/controllers/ControleurRequete.php
+12
-12
tp2/src/models/Game_publishers.php
tp2/src/models/Game_publishers.php
+14
-0
tp2/src/models/Perso.php
tp2/src/models/Perso.php
+14
-0
No files found.
tp2/src/controllers/ControleurRequete.php
View file @
26cbd7b3
...
...
@@ -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_publisher
s
;
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_publisher
s'
,
'game.id'
,
'='
,
'game_publishers
.game_id'
)
->
join
(
'company'
,
'game_publisher
s
.comp_id'
,
'='
,
'company.id'
)
->
select
(
'
game.id'
,
'game.name
'
)
->
where
(
'company.name'
,
'LIKE'
,
'%Sony%'
)
->
get
()
;
$vue
=
new
RequeteView
(
$data
);
$vue
->
render
(
1
);
...
...
tp2/src/models/Game_publisher.php
→
tp2/src/models/Game_publisher
s
.php
View file @
26cbd7b3
...
...
@@ -2,13 +2,13 @@
namespace
bdd\models
;
class
Game_publisher
extends
\Illuminate\Database\Eloquent\Model
class
Game_publisher
s
extends
\Illuminate\Database\Eloquent\Model
{
protected
$table
=
'game_publisher'
;
protected
$table
=
'game_publisher
s
'
;
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_publisher
s
'
,
'game_id'
);
}
}
\ No newline at end of file
tp2/src/models/
Character
.php
→
tp2/src/models/
Perso
.php
View file @
26cbd7b3
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment