Defice transformer for legacy support.
This commit is contained in:
35
app/Domain/Legacy/Transformers/DeviceTransformer.php
Normal file
35
app/Domain/Legacy/Transformers/DeviceTransformer.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Legacy\Transformers;
|
||||
|
||||
use App\Models\Device;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class DeviceTransformer
|
||||
{
|
||||
public function index(Collection $devices): array
|
||||
{
|
||||
return $devices->map(function (Device $device) {
|
||||
return [
|
||||
"device" => [
|
||||
"hostname" => "2",
|
||||
"sleepTime" => 0,
|
||||
],
|
||||
"state" => "success",
|
||||
"value" => "0"
|
||||
];
|
||||
})->toArray();
|
||||
}
|
||||
|
||||
public function show(Device $device): array
|
||||
{
|
||||
return [
|
||||
"device" => [
|
||||
"hostname" => "2",
|
||||
"sleepTime" => 0,
|
||||
],
|
||||
"state" => "success",
|
||||
"value" => "0"
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user