$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
}
$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
}