Compare commits

...

1 Commits
9.1.4 ... 9.1.5

Author SHA1 Message Date
Deon George
b3471f31a0 Fix singleOrFail() args are optional 2022-02-02 12:05:03 +11:00

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)