📌  相关文章
📜  laravel 检查是否刚刚创建了 eloquent - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:01.545000             🧑  作者: Mango

代码示例1
$item = Item::firstOrCreate(['title' => 'Example Item']);

if ($item->wasRecentlyCreated === true) {
    // item wasn't found and have been created in the database
} else {
    // item was found and returned from the database
}