Model Marks
| Model | Extends | Table | Path |
|---|---|---|---|
| Marks_Model | Plain_Model | marks | /application/models/marks_model.php |
Loading the model
$this->load->model('marks_model', 'marks');
Properties
| Property | Visibility | Default Value | Description |
|---|---|---|---|
| $sort | Public | created_on DESC | The default sort direction for reads. |
Methods
__construct - Public
Called automatically which in turn calls the parent constructor and sets the model $data_types properties.
create - Public
Used to create new records in the marks table.
Arguments
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
| $options | array | array() | Yes | An associative array that contains the column names and the values for the record to be created. Array keys are the column names for each value. |
| $options['title'] | string | N/A/td> | Yes | The title for the mark. |
| $options['url'] | string | N/A/td> | Yes | The full url for the mark. |
Example
$this->load->model('marks_model', 'marks'); $mark = $this->marks->create(array('title' => $title, 'url' => $url)); // If mark was created if (isset($mark->mark_id)) { // Good to go } // Some sort of validation error elseif (isset($mark['errors']) { // Validation errors were found } // Some sort of database write error, check logs else { // will return false }