insert
Insert a new record.
Usage:
$db->{table}->insert($data);
Example:
Table
Model
Database
news
News
$db->news
news_details
NewsDetails
$db->news_details
news_attachments_ids
NewsAttachmentsIds
$db->news_attachments_ids
// First declare your model
// where "News" is your table name in capital case
$data = new News();
$data->name = 'My news';
$data->status = 'ACTIVE';
$news = $db->news->insert($data);
echo json_encode($news);
Return:
{
"id": "AUTO_GENERATED_ID",
"name": "Test News",
"status": "ACTIVE",
"created_at": "2024-11-03 21:07:37",
"updated_at": null,
"deleted_at": null
}
Last updated