3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-02-04 18:05:26 +00:00
Files
snipe-it/app/Http/Transformers/DatatablesTransformer.php
2025-06-27 11:37:31 +01:00

29 lines
793 B
PHP

<?php
namespace App\Http\Transformers;
class DatatablesTransformer
{
/**
* Transform data for bootstrap tables and API responses for lists of things
**/
public function transformDatatables($objects, $total = null)
{
(isset($total)) ? $objects_array['total'] = $total : $objects_array['total'] = count($objects);
$objects_array['rows'] = $objects;
return $objects_array;
}
/**
* Transform data for returning the status of items within a bulk action
**/
public function transformBulkResponseWithStatusAndObjects($objects, $total)
{
(isset($total)) ? $objects_array['total'] = $total : $objects_array['total'] = count($objects);
$objects_array['rows'] = $objects;
return $objects_array;
}
}