Skip to main content

Model::__construct

Model class constructor

Description

public self Model::__construct( [ boolean $is_admin = false, array $options = [] ] )

Arguments

NameData typeDefaultRemarks
$is_adminbooleanfalseFlag for displaying record that disabled visibility flag (For Admin page)
$optionsarray[]Model options

Example

Controller
// For client page (Don't display hidden record)
$model = new Model(false, array(
// Operate to `cms_news` table
'table' => 'cms_news',

// Primary ID is `id`
'id' => 'news_id',

// Visibility flag is `visible`
'visible' => 'visible',

// Bind columns data type
'bind' => array(
'news_id' => 'INTEGER',
'image_id' => 'INTEGER',
'file_id' => 'INTEGER',
'post_date' => 'DATETIME',
),
));