mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Fixes #3799 - use transformers on show() method as well
This commit is contained in:
parent
ccb7556281
commit
4e5cf531f7
|
@ -79,7 +79,8 @@ class CompaniesController extends Controller
|
|||
{
|
||||
$this->authorize('view', Company::class);
|
||||
$company = Company::findOrFail($id);
|
||||
return $company;
|
||||
return (new CompaniesTransformer)->transformCompany($company);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class ManufacturersController extends Controller
|
|||
{
|
||||
$this->authorize('view', Manufacturer::class);
|
||||
$manufacturer = Manufacturer::findOrFail($id);
|
||||
return $manufacturer;
|
||||
return (new ManufacturersTransformer)->transformManufacturer($manufacturer);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class SuppliersController extends Controller
|
|||
{
|
||||
$this->authorize('view', Supplier::class);
|
||||
$supplier = Supplier::findOrFail($id);
|
||||
return $supplier;
|
||||
return (new SuppliersTransformer)->transformSupplier($supplier);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@ class SuppliersTransformer
|
|||
{
|
||||
if ($supplier) {
|
||||
|
||||
|
||||
|
||||
$array = [
|
||||
'id' => (int) $supplier->id,
|
||||
'name' => e($supplier->name),
|
||||
|
@ -38,6 +36,7 @@ class SuppliersTransformer
|
|||
'contact' => ($supplier->contact) ? e($supplier->contact) : null,
|
||||
'assets_count' => (int) $supplier->assets_count,
|
||||
'licenses_count' => (int) $supplier->licenses_count,
|
||||
'image' => ($supplier->image) ? e($supplier->image) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($supplier->updated_at, 'datetime'),
|
||||
|
||||
|
|
Loading…
Reference in a new issue