Skip to main content
Version: Fegg 5.x (next)

Model::exists

Check whether a row matches

Description​

public bool Model::exists()

Returns true when at least one row matches.

Example​

Controller
$model = new Model(false, array(
'table' => 'cms_news',
'id' => 'news_id',
'visible' => 'visible',
));

if ($model->where('title = ?', $title)->exists()) {
// a news with this title already exists
}