From 268f78d912bf4fe84c6d03fa30747067ef225fcd Mon Sep 17 00:00:00 2001
From: Nathan <nat.che@hotmail.fr>
Date: Wed, 25 Mar 2020 11:16:42 +0100
Subject: [PATCH] Ajout des modeles de commentaire et de user

---
 Seance5-6/seance/Question1.php             |  6 ----
 Seance5-6/seance/src/modele/Commentary.php | 24 ++++++++++++++++
 Seance5-6/seance/src/modele/User.php       | 33 ++++++++++++++++++++++
 3 files changed, 57 insertions(+), 6 deletions(-)
 delete mode 100644 Seance5-6/seance/Question1.php
 create mode 100644 Seance5-6/seance/src/modele/Commentary.php
 create mode 100644 Seance5-6/seance/src/modele/User.php

diff --git a/Seance5-6/seance/Question1.php b/Seance5-6/seance/Question1.php
deleted file mode 100644
index b186074..0000000
--- a/Seance5-6/seance/Question1.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-require 'vendor/autoload.php';
-use seance\reponse\CQuestion1;
-
-$q = new CQuestion1();
\ No newline at end of file
diff --git a/Seance5-6/seance/src/modele/Commentary.php b/Seance5-6/seance/src/modele/Commentary.php
new file mode 100644
index 0000000..bad1224
--- /dev/null
+++ b/Seance5-6/seance/src/modele/Commentary.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace seance\modele;
+
+
+class Commentary extends \Illuminate\Database\Eloquent\Model
+{
+    protected $table = 'commentary';
+    protected $primaryKey = 'id';
+    public $timestamps = false;
+
+
+    public function commentaires(){
+        return $this->belongsTo('seance\modele\User', 'id');
+    }
+
+
+    public function commente(){
+        return $this->belongsTo('seance\modele\Game', 'id');
+    }
+
+
+
+}
\ No newline at end of file
diff --git a/Seance5-6/seance/src/modele/User.php b/Seance5-6/seance/src/modele/User.php
new file mode 100644
index 0000000..e584f48
--- /dev/null
+++ b/Seance5-6/seance/src/modele/User.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace seance\modele;
+
+
+class User extends \Illuminate\Database\Eloquent\Model
+{
+    protected $table = 'user';
+    protected $primaryKey = 'id';
+    public $timestamps = false;
+
+
+    public function commentaires(){
+        return $this->hasMany('seance\modele\Commentary', 'userID');
+    }
+
+
+//    public function first_appeared_in_game(){
+//        return $this->belongsTo('seance\modele\Game', 'id');
+//    }
+//
+//    public function appears_in(){
+//        return $this->belongsToMany('seance\modele\Game', 'game2character', 'character_id', 'game_id');
+//    }
+//
+//
+//    public function enemies(){
+//        return $this->belongsToMany('seance\modele\Character', 'enemies', 'char1_id', 'char2_id');
+//    }
+//    public function friends(){
+//        return $this->belongsToMany('seance\modele\Character', 'friends', 'char1_id', 'char2_id');
+//    }
+}
\ No newline at end of file
-- 
GitLab