mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
Pull out extraneous use statements
This commit is contained in:
parent
89edda2c23
commit
b968839a1d
|
@ -9,24 +9,9 @@ use App\Models\Company;
|
|||
use App\Models\CustomField;
|
||||
use App\Models\Location;
|
||||
use App\Models\User;
|
||||
use Artisan;
|
||||
use Auth;
|
||||
use Config;
|
||||
use DB;
|
||||
use Gate;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Log;
|
||||
use Mail;
|
||||
use Paginator;
|
||||
use Response;
|
||||
use Slack;
|
||||
use Str;
|
||||
use TCPDF;
|
||||
use Validator;
|
||||
use View;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Transformers\AssetsTransformer;
|
||||
|
||||
/**
|
||||
* This class controls all actions related to assets for
|
||||
|
|
55
app/Http/Transformers/AssetsTransformer.php
Normal file
55
app/Http/Transformers/AssetsTransformer.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
namespace App\Http\Transformers;
|
||||
|
||||
use App\Models\Asset;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class AssetsTransformer
|
||||
{
|
||||
|
||||
public function transformAssets (Collection $assets, $total)
|
||||
{
|
||||
$array = array();
|
||||
foreach ($assets as $asset) {
|
||||
$array[] = self::transformAsset($asset);
|
||||
}
|
||||
return (new DatatablesTransformer)->transformDatatables($array, $total);
|
||||
}
|
||||
|
||||
public function transformAsset (Asset $asset)
|
||||
{
|
||||
$array = [
|
||||
'id' => $asset->id,
|
||||
'name' => $asset->name,
|
||||
'asset_tag' => $asset->asset_tag,
|
||||
'serial' => $asset->serial,
|
||||
'model' => $asset->model->name,
|
||||
'model_number' => $asset->model_number,
|
||||
'status_label' => $asset->assetstatus->name,
|
||||
'last_checkout' => $asset->last_checkout,
|
||||
'category' => $asset->model->category->name,
|
||||
'manufacturer' => $asset->manufacturer,
|
||||
'notes' => $asset->notes,
|
||||
'expected_checkin' => $asset->expected_checkin,
|
||||
'order_number' => $asset->order_number,
|
||||
'companyName' => $asset->companyName,
|
||||
'location' => ($asset->assetLoc) ? $asset->assetLoc->name : '',
|
||||
'image' => $asset->image,
|
||||
'assigned_to' => ($asset->assigneduser) ? $asset->assigneduser->present()->fullName() : '',
|
||||
'created_at' => $asset->created_at,
|
||||
'purchase_date' => $asset->purchase_date,
|
||||
'purchase_cost' => $asset->purchase_cost,
|
||||
'company' => ($asset->company) ? $asset->company->name: '',
|
||||
|
||||
];
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
public function transformAssetsDatatable($users) {
|
||||
return (new DatatablesTransformer)->transformDatatables($users);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue