mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Added updated/created to locations API
This commit is contained in:
parent
c132036f5c
commit
caf2f648b1
|
@ -20,7 +20,8 @@ class LocationsController extends Controller
|
|||
public function index(Request $request)
|
||||
{
|
||||
$this->authorize('view', Location::class);
|
||||
$allowed_columns = ['id','name','address','address2','city','state','country','zip'];
|
||||
$allowed_columns = ['id','name','address','address2','city','state','country','zip','created_at',
|
||||
'updated_at'];
|
||||
|
||||
$locations = Location::select([
|
||||
'locations.id',
|
||||
|
@ -32,6 +33,8 @@ class LocationsController extends Controller
|
|||
'locations.zip',
|
||||
'locations.country',
|
||||
'locations.parent_id',
|
||||
'locations.created_at',
|
||||
'locations.updated_at',
|
||||
'locations.currency'
|
||||
])->withCount('assets')->withCount('users');
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Http\Transformers;
|
|||
use App\Models\Location;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Gate;
|
||||
use App\Helpers\Helper;
|
||||
|
||||
class LocationsTransformer
|
||||
{
|
||||
|
@ -36,6 +37,8 @@ class LocationsTransformer
|
|||
'assets_default' => $location->assignedassets()->count(),
|
||||
'country' => e($location->country),
|
||||
'assets' => $assets_arr,
|
||||
'created_at' => Helper::getFormattedDateObject($location->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($location->updated_at, 'datetime'),
|
||||
];
|
||||
|
||||
$permissions_array['available_actions'] = [
|
||||
|
|
Loading…
Reference in a new issue