Open
Description
The Model should provide a new convenience method, findOrCreate
that can be given a set of criteria to locate within the db table, or create a new record using that data and an additional set of data that was provided.
Must work with all currently supported databases.
Undecided which version would work fit the project best, so am open to discussion on this one:
$userModel->where('email', 'johnsmith@example.com')->findOrCreate(['key' => 'value', ...]);
// or
$userModel->findOrCreate(['existing_key' => 'value'], ['new_key' => 'value']);
References: