Skip to content

Commit

Permalink
Safety checks on product options
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-GG committed Oct 19, 2023
1 parent b01db37 commit 3828e88
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion resources/views/product/partials/options.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="flex flex-col space-y-3">
@foreach($product->options->sortBy('sort_order') as $option)
<div>
@include('rapidez::product.partials.options.'.($option->type_id ?? $option->type))
@includeIf('rapidez::product.partials.options.'.($option->type_id ?? $option->type))
</div>
@endforeach
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Models/ProductOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function product()
protected function title(): Attribute
{
return Attribute::make(
get: fn () => $this->titles->firstForCurrentStore()->title,
get: fn () => $this->titles->firstForCurrentStore()->title ?? null,
)->shouldCache();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Models/ProductOptionTypeValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function option()
protected function title(): Attribute
{
return Attribute::make(
get: fn () => $this->titles->firstForCurrentStore()->title,
get: fn () => $this->titles->firstForCurrentStore()->title ?? null,
)->shouldCache();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Models/QuoteItemOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function value(): Attribute
protected function label(): Attribute
{
return Attribute::make(
get: fn () => $this->option?->titles->firstForCurrentStore()->title
get: fn () => $this->option?->titles->firstForCurrentStore()->title ?? null
)->shouldCache();
}

Expand Down

0 comments on commit 3828e88

Please sign in to comment.