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);
|
$this->authorize('view', Company::class);
|
||||||
$company = Company::findOrFail($id);
|
$company = Company::findOrFail($id);
|
||||||
return $company;
|
return (new CompaniesTransformer)->transformCompany($company);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class ManufacturersController extends Controller
|
||||||
{
|
{
|
||||||
$this->authorize('view', Manufacturer::class);
|
$this->authorize('view', Manufacturer::class);
|
||||||
$manufacturer = Manufacturer::findOrFail($id);
|
$manufacturer = Manufacturer::findOrFail($id);
|
||||||
return $manufacturer;
|
return (new ManufacturersTransformer)->transformManufacturer($manufacturer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ class SuppliersController extends Controller
|
||||||
{
|
{
|
||||||
$this->authorize('view', Supplier::class);
|
$this->authorize('view', Supplier::class);
|
||||||
$supplier = Supplier::findOrFail($id);
|
$supplier = Supplier::findOrFail($id);
|
||||||
return $supplier;
|
return (new SuppliersTransformer)->transformSupplier($supplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ class SuppliersTransformer
|
||||||
{
|
{
|
||||||
if ($supplier) {
|
if ($supplier) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$array = [
|
$array = [
|
||||||
'id' => (int) $supplier->id,
|
'id' => (int) $supplier->id,
|
||||||
'name' => e($supplier->name),
|
'name' => e($supplier->name),
|
||||||
|
@ -38,6 +36,7 @@ class SuppliersTransformer
|
||||||
'contact' => ($supplier->contact) ? e($supplier->contact) : null,
|
'contact' => ($supplier->contact) ? e($supplier->contact) : null,
|
||||||
'assets_count' => (int) $supplier->assets_count,
|
'assets_count' => (int) $supplier->assets_count,
|
||||||
'licenses_count' => (int) $supplier->licenses_count,
|
'licenses_count' => (int) $supplier->licenses_count,
|
||||||
|
'image' => ($supplier->image) ? e($supplier->image) : null,
|
||||||
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
|
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
|
||||||
'updated_at' => Helper::getFormattedDateObject($supplier->updated_at, 'datetime'),
|
'updated_at' => Helper::getFormattedDateObject($supplier->updated_at, 'datetime'),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue