Extra Light PHP Framework
Models
This class is loaded automatically by the system
Content
How to create a model
How to load a model
$this->load_library('Model');
$news = Loader::load_model('news')'
How to use a model
Available methods:- save()
- get_all($limit = false, $where = false, $order_by = 'id DESC')
- get_by_id($id, $col_name = 'id')
- smart_find($term, $fields, $min_chars = 5, $order_by = 'id DESC'
// insert or update
$news->id = 1;
$news->title = 'Hello';
$news->content = 'World';
$news->save();
// if $news->id is set $news->save() will update the record,
// else a new record will be created
// get all news
$news->get_all(); // return $database->result();
// get by id
$news->get_by_id(24); // return $database->result();
// smart find
$news->smart_find('foo bar', 'title, content'); // return $database->result();