diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 3a4b18d..7f9cc46 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -44,6 +44,14 @@ class ProductController extends Controller ->sortBy('name') ->values(); + case 'App\Models\Product\Generic': + return Product\Generic::select(['id','supplier_item_id']) + ->with(['supplied.supplier_detail.supplier']) + ->get() + ->map(function($item) { return ['id'=>$item->id,'name'=>sprintf('%s: %s',$item->supplied->supplier_detail->supplier->name,$item->supplied->name)]; }) + ->sortBy('name') + ->values(); + case 'App\Models\Product\Host': return Product\Host::select(['id','supplier_item_id']) ->with(['supplied.supplier_detail.supplier']) diff --git a/app/Models/Product.php b/app/Models/Product.php index 83de383..8459327 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -294,7 +294,7 @@ class Product extends Model implements IDs */ public function getSuppliedAttribute(): ?Model { - return $this->type && $this->type->supplied ? $this->type->supplied : NULL; + return $this->type->supplied ? $this->type->supplied : NULL; } /** @@ -426,7 +426,7 @@ class Product extends Model implements IDs */ public function hasUsage(): bool { - return $this->type && $this->type->hasUsage(); + return $this->type->hasUsage(); } /** diff --git a/app/Models/Service.php b/app/Models/Service.php index b0c79d6..f7d3e14 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -786,7 +786,7 @@ class Service extends Model implements IDs */ public function getNameShortAttribute() { - return ($this->type && $this->type->getServiceNameAttribute()) ? $this->type->getServiceNameAttribute() : 'SID:'.$this->sid; + return $this->type->getServiceNameAttribute() ? $this->type->getServiceNameAttribute() : 'SID:'.$this->sid; } /** @@ -801,7 +801,7 @@ class Service extends Model implements IDs */ public function getNameDetailAttribute() { - return ($this->type && ($this->type->getServiceDescriptionAttribute() !== NULL)) ? $this->type->getServiceDescriptionAttribute() : 'No Description'; + return ($this->type->getServiceDescriptionAttribute() !== NULL) ? $this->type->getServiceDescriptionAttribute() : 'No Description'; } /** diff --git a/app/Models/Service/SSL.php b/app/Models/Service/SSL.php index 285ce63..846faf1 100644 --- a/app/Models/Service/SSL.php +++ b/app/Models/Service/SSL.php @@ -45,10 +45,11 @@ class SSL extends Type if ($this->cert) return Arr::get($this->crt_parse,'name'); - else { + elseif ($this->csr) { $dn = ''; $dna = openssl_csr_get_subject($this->csr); + dump(['dna'=>$dna,'csr'=>$this->csr,'id',$this->id]); foreach ($dna as $k=>$v) { if ($dn) $dn .= ','; @@ -57,6 +58,8 @@ class SSL extends Type } return $dn; + } else { + return '[NO DN]'; } } diff --git a/resources/views/theme/backend/adminlte/product/widget/detail.blade.php b/resources/views/theme/backend/adminlte/product/widget/detail.blade.php index 0961012..772bbb6 100644 --- a/resources/views/theme/backend/adminlte/product/widget/detail.blade.php +++ b/resources/views/theme/backend/adminlte/product/widget/detail.blade.php @@ -3,7 +3,7 @@

Product Details @include('adminlte::widget.success_button')


-@dump($errors) +
@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), ])
diff --git a/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php b/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php index c00a5a0..6421da1 100644 --- a/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php +++ b/resources/views/theme/backend/adminlte/service/widget/broadband/change.blade.php @@ -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';