<?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 ChovPlanyModel extends Repository {
    
    public function getAktualniVrhy() {
            return $this->connection->table('vrhy')
            ->where('aktualni = ?', 1);
    }
    
    public function getOcekavaneVrhy() {
            return $this->connection->table('vrhy')
            ->where('aktualni',0)->where('plany',0);
    }
    
    public function getArchivniVrhy() {
            return $this->connection->table('vrhy')
            ->where('archiv',1);
    }
    
    
    
    public function updateVrh($id, $data) {
    $this->connection->table('vrhy')
        ->where('id = ?', $id)
        ->update($data);
    }

    public function deleteVrh($id) {
        $this->connection->table('vrhy')
            ->where('id = ?', $id)
            ->delete();
    }
    
    public function addVrh($data) {
    $this->connection->table('vrhy')
        ->insert($data);
    }
    
    
}

