📜  雄辩的 firstOrCreate - PHP 代码示例

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

代码示例2
firstOrCreate() will automatically create a new entry in the database if there is not match found. Otherwise it will give you the matched item.
firstOrNew() will give you a new model instance to work with if not match was found, but will only be saved to the database when you explicitly do so (calling save() on the model). Otherwise it will give you the matched item.