mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 23:54:12 -08:00
e3e0d57f56
* Add IDE Helper files * Cleanup imports - Alphabetises imports - Removes unused imports * Add Platform requirements * Move filling asset into block where asset exists * Remove duplicate array keys
41 lines
1 KiB
PHP
41 lines
1 KiB
PHP
<?php
|
|
namespace App\Http\Transformers;
|
|
|
|
use App\Models\Import;
|
|
use App\Models\Setting;
|
|
|
|
class ImportsTransformer
|
|
{
|
|
|
|
public function transformImports($imports)
|
|
{
|
|
$array = array();
|
|
foreach ($imports as $import) {
|
|
$array[] = self::transformImport($import);
|
|
}
|
|
return $array;
|
|
}
|
|
|
|
public function transformImport(Import $import)
|
|
{
|
|
$array = [
|
|
'id' => (int) $import->id,
|
|
'file_path' => e($import->file_path),
|
|
'filesize' => Setting::fileSizeConvert($import->filesize),
|
|
'name' => e($import->name),
|
|
'import_type' => e($import->import_type),
|
|
'created_at' => $import->created_at->diffForHumans(),
|
|
'header_row' => $import->header_row,
|
|
'first_row' => $import->first_row,
|
|
'field_map' => $import->field_map,
|
|
];
|
|
|
|
return $array;
|
|
}
|
|
|
|
public function transformImportsDatatable($imports)
|
|
{
|
|
return (new DatatablesTransformer)->transformDatatables($imports);
|
|
}
|
|
}
|