mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Use statics for location, supplier, etc
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
14c78d9065
commit
1c1729854e
|
@ -52,7 +52,7 @@ class ActionlogsTransformer
|
|||
static $custom_fields = false;
|
||||
|
||||
if ($custom_fields === false) {
|
||||
$custom_fields = CustomField::all();
|
||||
$custom_fields = CustomField::all();
|
||||
}
|
||||
|
||||
if ($actionlog->filename!='') {
|
||||
|
@ -221,13 +221,30 @@ class ActionlogsTransformer
|
|||
*/
|
||||
|
||||
public function changedInfo(array $clean_meta)
|
||||
{ $location = Location::withTrashed()->get();
|
||||
$supplier = Supplier::withTrashed()->get();
|
||||
$model = AssetModel::withTrashed()->get();
|
||||
$status = Statuslabel::withTrashed()->get();
|
||||
$company = Company::get();
|
||||
{
|
||||
static $location = false;
|
||||
static $supplier = false;
|
||||
static $model = false;
|
||||
static $status = false;
|
||||
static $company = false;
|
||||
|
||||
|
||||
if ($location === false) {
|
||||
$location = Location::select('id', 'name')->withTrashed()->get();
|
||||
}
|
||||
if ($supplier === false) {
|
||||
$supplier = Supplier::select('id', 'name')->withTrashed()->get();
|
||||
}
|
||||
if ($model === false) {
|
||||
$model = AssetModel::select('id', 'name')->withTrashed()->get();
|
||||
}
|
||||
if ($status === false) {
|
||||
$status = Statuslabel::select('id', 'name')->withTrashed()->get();
|
||||
}
|
||||
if ($company === false) {
|
||||
$company = Company::select('id', 'name')->get();
|
||||
}
|
||||
|
||||
if(array_key_exists('rtd_location_id',$clean_meta)) {
|
||||
|
||||
$oldRtd = $location->find($clean_meta['rtd_location_id']['old']);
|
||||
|
|
Loading…
Reference in a new issue