<?php
namespace Modules\Form_contato\Models;

use App\Models\BaseModel;

class Model_form_contato extends BaseModel {
	public function getCadastros() {
		$table 		= "form_contato";
		$builder  = $this->db->table($table);
		$query    = $builder->get();

		return $query->getResult();
	}

	public function alterar($id) {
		$table 		= "form_contato";
		$builder  = $this->db->table($table);

		$builder->set('ativo', 1);
		$builder->set('data_alteracao', date("Y-m-d H:i:s"));
		$builder->where('id', $id);
		$builder->update();
		
		$table 		= "form_contato";
		$builder  = $this->db->table($table)->where('id', $id);
		$query    = $builder->get();

		$consulta = $query->getRow();

		return $consulta;
	}

	public function deletar($id) {
		$table 		= "form_contato";
		$builder  = $this->db->table($table);
		
		$builder->where('id', $id);
		$builder->delete();
	}
}