public function run()
 {
     $genres = ['Action', 'Comedy', 'Family', 'History', 'Mystery', 'Sci-Fi'];
     foreach ($genres as $genre) {
         Genre::create(['name' => $genre, 'slug' => Str::slug($genre)]);
     }
 }
Example #2
0
 public function getById($id)
 {
     $dbh = new PDO($DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select naam , stamboomnaam, soort, ras, geboortedatum, chipnummer,\n           paspoortnummer,kleur, medbeeld, klantid\n           from dier , klant    where dierId=dier.id and klant.id = " . $id;
     $resultset = $dbh->query($sql);
     $rij = $resultSet->fetch();
     $genre = Genre::create($id, $rij["naam"]);
     $dbh = null;
     return $dier;
 }
 public static function getById($id)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "SELECT omschrijving FROM mvc_genres WHERE id = " . $id;
     $resultSet = $dbh->query($sql);
     $rij = $resultSet->fetch();
     $genre = Genre::create($id, $rij["omschrijving"]);
     $dbh = NULL;
     return $genre;
 }
Example #4
0
 public function getById($id)
 {
     $dbh = new PDO($DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select naam from dieren \n               where id = {$id}";
     $resultset = $dbh->query($sql);
     $rij = $resultSet->fetch();
     $genre = Genre::create($id, $rij["naam"]);
     $dbh = null;
     return $dier;
 }
Example #5
0
 public function getById($id)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select genre from mvc_genres where id = :id";
     $stmt = $dbh->prepare($sql);
     $stmt->execute(array(':id' => $id));
     $rij = $stmt->fetch(PDO::FETCH_ASSOC);
     $genre = Genre::create($id, $rij["genre"]);
     $dbh = null;
     return $genre;
 }
Example #6
0
 public function getById($id)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select mvc_boeken.id as boek_id, titel, genre_id, genre  \n                    from mvc_boeken, mvc_genres  \n                    where genre_id = mvc_genres.id and mvc_boeken.id = :id";
     $stmt = $dbh->prepare($sql);
     $stmt->execute(array(':id' => $id));
     $rij = $stmt->fetch(PDO::FETCH_ASSOC);
     $genre = Genre::create($rij["genre_id"], $rij["genre"]);
     $boek = Boek::create($rij["boek_id"], $rij["titel"], $genre);
     $dbh = null;
     return $boek;
 }
 public static function getByTitel($titel)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "SELECT mvc_boeken.id as boekid, titel, genreid, omschrijving FROM mvc_boeken, mvc_genres WHERE genreid = mvc_genres.id AND titel = '" . $titel . "'";
     $resultSet = $dbh->query($sql);
     $rij = $resultSet->fetch();
     if (!$rij) {
         return null;
     } else {
         $genre = Genre::create($rij["genreid"], $rij["omschrijving"]);
         $boek = Boek::create($rij["boekid"], $rij["titel"], $genre);
         $dbh = NULL;
         return $boek;
     }
 }
 public function getByTitel($titel)
 {
     $sql = "select mvc_boeken.id as boek_id, titel, genre_id, genre from mvc_boeken, mvc_genres where titel = :titel";
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $stmt = $dbh->prepare($sql);
     $stmt->execute(array(':titel' => $titel));
     $rij = $stmt->fetch(PDO::FETCH_ASSOC);
     if (!$rij) {
         return null;
     } else {
         $genre = Genre::create($rij["genre_id"], $rij["genre"]);
         $boek = Boek::create($rij["boek_id"], $titel, $rij["genre"]);
         $dbh = null;
         return $boek;
     }
 }
Example #9
0
 private static function initGenres(Genre $gender)
 {
     $datas = array(array('id' => 1, 'name' => 'Hombre'), array('id' => 2, 'name' => 'Mujer'));
     foreach ($datas as $data) {
         $gender->create();
         $gender->save($data);
     }
     return true;
 }