<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class PsiModel extends Repository {
    
    public $id;
    
    public function getVsechnyPsy() {
            return $this->connection->table('chovni_psi');
            //->where('stranka = ?', $stranka);
                   // ->fetch();
    }
    
    public function updatePes($id, $data) {
    $this->connection->table('chovni_psi')
        ->where('id = ?', $id)
        ->update($data);
    }
    
    
    
    public function getAktivniPsy() {
            return $this->connection->table('chovni_psi')
            ->where('fena = ?', 0)->where('vyrazen',0);
                   // ->fetch();
    }
    
    public function getAktivniFeny() {
            return $this->connection->table('chovni_psi')
            ->where('fena = ?', 1)->where('vyrazen',0);
                   // ->fetch();
    }
    
    public function getVyrazenePsy() {
            return $this->connection->table('chovni_psi')
            ->where('fena = ?', 0)->where('vyrazen',1);
                   // ->fetch();
    }
    
    public function getVyrazeneFeny() {
            return $this->connection->table('chovni_psi')
            ->where('fena = ?', 1)->where('vyrazen',1);
                   // ->fetch();
    }
    
    public function getVyrazene() {
            return $this->connection->table('chovni_psi')
            ->where('vyrazen = ?', 1);
                   // ->fetch();
    }
    
    public function getPesById($id) {
            return $this->connection->table('chovni_psi')
            ->where('id = ?', $id)->fetch();
    }
    
  

    public function deletePes($id) {
        $this->connection->table('chovni_psi')
            ->where('id = ?', $id)
            ->delete();
    }
    
    public function addPes($data) {
    $row = $this->connection->table('chovni_psi')
        ->insert($data);
    $this->id = $row->id;
    }
    

}

