$db->{table}->findOne($where)
$news = $db->news->findOne($where);
echo json_encode($news);
{
"id": "1",
"name": "Test News",
"status": "ACTIVE",
"created_at": "2024-11-03 21:07:37",
"updated_at": null,
"deleted_at": null
}
$news = $db->news->findOne(1);
// {
// "id": "1",
// "name": "Test News",
// "status": "ACTIVE",
// "created_at": "2024-11-03 21:07:37",
// "updated_at": null,
// "deleted_at": null
// }
// If not existing
$news = $db->news->findOne(0);
// null
$news = $db->news->findOne(
array(
'name' => 'Test News'
)
);
// {
// "id": "1",
// "name": "Test News",
// "status": "ACTIVE",
// "created_at": "2024-11-03 21:07:37",
// "updated_at": null,
// "deleted_at": null
// }