mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
5ba2ec881c
* Begin work on vueifying the importer * Beginning work on migrating the importer to use a vue/components for future interactivity Update JS More importer work. Move to a vue based modal, begin handling of processing. Still need to port error messages. More importer work. Move to a vue based modal, begin handling of processing. Still need to port error messages. Update importer. Add error display. Fix modal, update vue-strap to vue2 More progress. Add select2 vue bits. * Move to querying the db to find importer matches. It scales better on large datasets. Fix select2 related issues. We were trying to initialize it twice, which led to the custom data being overwritten. * Better error handling on uploads and deletion of files. Restore progressbar on upload. * Add support for generic exception reporting if app.debug is enabled. * Handle Http 500 errors better. Display errors if debug is enabled. Assorted cleanups. * Fix codacy issues, remove unused methods. * Only bind vue to the importer for now. * Load vue for passport as well.
40 lines
945 B
PHP
40 lines
945 B
PHP
<?php
|
|
namespace App\Http\Transformers;
|
|
|
|
use App\Models\Import;
|
|
use App\Models\Setting;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
|
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' => $import->id,
|
|
'file_path' => $import->file_path,
|
|
'filesize' => Setting::fileSizeConvert($import->filesize),
|
|
'name' => $import->name,
|
|
'import_type' => $import->import_type,
|
|
'created_at' => $import->created_at->diffForHumans(),
|
|
|
|
];
|
|
|
|
return $array;
|
|
}
|
|
|
|
public function transformImportsDatatable($imports)
|
|
{
|
|
return (new DatatablesTransformer)->transformDatatables($imports);
|
|
}
|
|
}
|