Compare commits

..

2 Commits
9.1.3 ... 9.1.5

Author SHA1 Message Date
Deon George
b3471f31a0 Fix singleOrFail() args are optional 2022-02-02 12:05:03 +11:00
Deon George
71712d445f Fix when blade call has no arguments 2021-12-20 14:35:58 +11:00
2 changed files with 6 additions and 7 deletions

View File

@@ -27,16 +27,15 @@ class CustomBladeServiceProvider extends ServiceProvider
private function resolve(string $content,string $expression): string
{
if (str_contains($expression,','))
if (str_contains($expression,',')) {
[$type,$arguments] = explode(',',$expression,2);
$arguments = explode('|',$arguments);
else {
} else {
$type = $expression;
$arguments = '';
$arguments = [];
}
$arguments = explode('|',$arguments);
$return = collect();
$urls = collect();

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)