Created
April 16, 2016 00:04
-
-
Save jlamim/d3666fa399d791795780d8c148fff682 to your computer and use it in GitHub Desktop.
Contatos_model - Criando um CRUD com CodeIgniter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Contatos_model extends MY_Model { | |
function __construct() { | |
parent::__construct(); | |
$this->table = 'contatos'; | |
} | |
/** | |
* Formata os contatos para exibição dos dados na home | |
* | |
* @param array $contatos Lista dos contatos a serem formatados | |
* | |
* @return array | |
*/ | |
function Formatar($contatos){ | |
if($contatos){ | |
for($i = 0; $i < count($contatos); $i++){ | |
$contatos[$i]['editar_url'] = base_url('editar')."/".$contatos[$i]['id']; | |
$contatos[$i]['excluir_url'] = base_url('excluir')."/".$contatos[$i]['id']; | |
} | |
return $contatos; | |
} else { | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment