<?php
class View_Experiencias_Inicio extends ViewModel
{
public function view()
{
$this->experiencias = Model_Entry::find('all');
}
}
<?php
class Model_Entry extends \Orm\Model
{
protected static $_properties = array(
'id',
'uid',
'name',
'description',
'media',
'created_at',
'updated_at',
);
protected static $_observers = array(
'Orm\Observer_CreatedAt' => array(
'events' => array('before_insert'),
'mysql_timestamp' => false,
),
'Orm\Observer_UpdatedAt' => array(
'events' => array('before_update'),
'mysql_timestamp' => false,
),
);
protected static $_table_name = 'entries';
public static function validate()
{
$val = Validation::forge();
$val->add_field('name', 'Nome', 'required|min_length[1]|max_length[8192]');
$val->add_field('description', 'Descrição', 'required|min_length[1]|max_length[8192]');
$val->add_field('media', 'Midia', 'required|min_length[1]|max_length[555]');
return $val;
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!