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

@@ -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'])