No longer need to test for type, it should exist

This commit is contained in:
2023-05-03 23:41:48 +10:00
parent 25dab73a83
commit a5238bfbdc
6 changed files with 19 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
<div class="col-12">
<h3>Product Details @include('adminlte::widget.success_button')</h3>
<hr>
@dump($errors)
<form class="g-0 needs-validation" method="POST" enctype="multipart/form-data" role="form">
@csrf
@@ -75,7 +75,7 @@
'old'=>'model',
'name'=>'model',
'options'=>$o->availableTypes()->transform(function($item) { return ['id'=>$item,'value'=>$item]; }),
'value'=>($o->type && $x=get_class($o->type)) ? $x : '',
'value'=>get_class($o->type),
])
</div>
</div>

View File

@@ -7,7 +7,7 @@
@php
$po = $selected = NULL;
@endphp
@foreach (\App\Models\Product::active()->get()->filter(function($item) { return $item->type && (get_class($item->type) == 'App\Models\Product\Broadband'); })->sortBy('name') as $o)
@foreach (\App\Models\Product::active()->get()->filter(function($item) { return get_class($item->type) === 'App\Models\Product\Broadband'; })->sortBy('name') as $o)
@php
if ($o->id == old('product_id')) {
$selected = 'selected';