<?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 ZpravyModel extends Repository {
   
    public function getZpravyByTyp($typ) {
            return $this->connection->table('zpravy')
            ->where('typ = ?', $typ);
    }
    
    public function getZpravaById($id) {
            return $this->connection->table('zpravy')
            ->where('id = ?', $id)->fetch();
    }
    
    public function updateZprava($id, $data) {
    $this->connection->table('zpravy')
        ->where('id = ?', $id)
        ->update($data);
    }
  

    public function deleteZprava($id) {
        $this->connection->table('zpravy')
            ->where('id = ?', $id)
            ->delete();
    }
    
    public function addZprava($data) {
    $this->connection->table('zpravy')
        ->insert($data);
    }
    

}

