Fix singleOrFail() args are optional

This commit is contained in:
Deon George 2022-02-02 12:05:03 +11:00
parent 71712d445f
commit b3471f31a0
1 changed files with 2 additions and 2 deletions

View File

@ -32,8 +32,8 @@ trait SingleOrFail
return NULL;
});
// When a query should return 1 object, or NULL if it doesnt
Builder::macro('singleOrNew',function ($args) {
// When a query should return 1 object, or setup to create a new object
Builder::macro('singleOrNew',function (array $args=[]) {
$result = $this->where($args)->get();
if ($result->count() == 1)