Fixes #3775 - added missing created_at and updated_at fields

This commit is contained in:
snipe 2017-07-29 17:01:03 -07:00
parent 5b420fb4b9
commit 03f9d01aab
6 changed files with 31 additions and 10 deletions

View file

@ -28,7 +28,9 @@ class DepartmentsController extends Controller
'name', 'name',
'location_id', 'location_id',
'company_id', 'company_id',
'manager_id' 'manager_id',
'created_at',
'updated_at'
])->with('users')->with('location')->with('manager')->with('company')->withCount('users'); ])->with('users')->with('location')->with('manager')->with('company')->withCount('users');
if ($request->has('search')) { if ($request->has('search')) {

View file

@ -22,7 +22,7 @@ class GroupsController extends Controller
$this->authorize('view', Group::class); $this->authorize('view', Group::class);
$allowed_columns = ['id','name','created_at']; $allowed_columns = ['id','name','created_at'];
$groups = Group::select('id','name','permissions')->withCount('users'); $groups = Group::select('id','name','permissions','created_at','updated_at')->withCount('users');
if ($request->has('search')) { if ($request->has('search')) {
$groups = $groups->TextSearch($request->input('search')); $groups = $groups->TextSearch($request->input('search'));

View file

@ -23,7 +23,7 @@ class SuppliersController extends Controller
$allowed_columns = ['id','name','address','phone','contact','fax','email']; $allowed_columns = ['id','name','address','phone','contact','fax','email'];
$suppliers = Supplier::select( $suppliers = Supplier::select(
array('id','name','address','address2','city','state','country','fax', 'phone','email','contact') array('id','name','address','address2','city','state','country','fax', 'phone','email','contact','created_at','updated_at','deleted_at')
)->withCount('assets')->withCount('licenses')->whereNull('deleted_at'); )->withCount('assets')->withCount('licenses')->whereNull('deleted_at');

View file

@ -4,6 +4,7 @@ namespace App\Http\Transformers;
use App\Models\AssetModel; use App\Models\AssetModel;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Gate; use Gate;
use App\Helpers\Helper;
class AssetModelsTransformer class AssetModelsTransformer
{ {
@ -23,15 +24,29 @@ class AssetModelsTransformer
$array = [ $array = [
'id' => (int) $assetmodel->id, 'id' => (int) $assetmodel->id,
'name' => e($assetmodel->name), 'name' => e($assetmodel->name),
'manufacturer' => ($assetmodel->manufacturer_id) ? $assetmodel->manufacturer : null, 'manufacturer' => ($assetmodel->manufacturer) ? [
'id' => (int) $assetmodel->manufacturer->id,
'name'=> e($assetmodel->manufacturer->name)
] : null,
'image' => ($assetmodel->image!='') ? url('/').'/uploads/models/'.e($assetmodel->image) : null, 'image' => ($assetmodel->image!='') ? url('/').'/uploads/models/'.e($assetmodel->image) : null,
'model_number' => e($assetmodel->model_number), 'model_number' => e($assetmodel->model_number),
'depreciation' => ($assetmodel->depreciation) ? $assetmodel->depreciation : 'No', 'depreciation' => ($assetmodel->depreciation) ? [
'id' => (int) $assetmodel->depreciation->id,
'name'=> e($assetmodel->depreciation->name)
] : null,
'assets_count' => $assetmodel->assets_count, 'assets_count' => $assetmodel->assets_count,
'category' => ($assetmodel->category_id) ? $assetmodel->category : null, 'category' => ($assetmodel->category) ? [
'fieldset' => ($assetmodel->fieldset) ? $assetmodel->fieldset : null, 'id' => (int) $assetmodel->category->id,
'name'=> e($assetmodel->category->name)
] : null,
'fieldset' => ($assetmodel->fieldset) ? [
'id' => (int) $assetmodel->fieldset->id,
'name'=> e($assetmodel->fieldset->name)
] : null,
'eol' => ($assetmodel->eol > 0) ? $assetmodel->eol .' months': 'None', 'eol' => ($assetmodel->eol > 0) ? $assetmodel->eol .' months': 'None',
'notes' => e($assetmodel->notes) 'notes' => e($assetmodel->notes),
'created_at' => Helper::getFormattedDateObject($assetmodel->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($assetmodel->updated_at, 'datetime'),
]; ];

View file

@ -25,7 +25,9 @@ class CustomFieldsTransformer
'name' => e($field->name), 'name' => e($field->name),
'db_column_name' => e($field->db_column_name()), 'db_column_name' => e($field->db_column_name()),
'format' => e($field->format), 'format' => e($field->format),
'required' => $field->pivot->required 'required' => $field->pivot->required,
'created_at' => Helper::getFormattedDateObject($field->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($field->updated_at, 'datetime'),
]; ];
return $array; return $array;
} }

View file

@ -38,7 +38,9 @@ class CustomFieldsetsTransformer
'id' => (int) $fieldset->id, 'id' => (int) $fieldset->id,
'name' => e($fieldset->name), 'name' => e($fieldset->name),
'fields' => (new CustomFieldsTransformer)->transformCustomFields($fields, $fieldset->fields_count), 'fields' => (new CustomFieldsTransformer)->transformCustomFields($fields, $fieldset->fields_count),
'models' => (new DatatablesTransformer)->transformDatatables($modelsArray, $fieldset->models_count) 'models' => (new DatatablesTransformer)->transformDatatables($modelsArray, $fieldset->models_count),
'created_at' => Helper::getFormattedDateObject($fieldset->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($fieldset->updated_at, 'datetime'),
]; ];
return $array; return $array;
} }