Fix singleOrFail() args are optional
This commit is contained in:
parent
71712d445f
commit
b3471f31a0
@ -32,8 +32,8 @@ trait SingleOrFail
|
|||||||
return NULL;
|
return NULL;
|
||||||
});
|
});
|
||||||
|
|
||||||
// When a query should return 1 object, or NULL if it doesnt
|
// When a query should return 1 object, or setup to create a new object
|
||||||
Builder::macro('singleOrNew',function ($args) {
|
Builder::macro('singleOrNew',function (array $args=[]) {
|
||||||
$result = $this->where($args)->get();
|
$result = $this->where($args)->get();
|
||||||
|
|
||||||
if ($result->count() == 1)
|
if ($result->count() == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user