Defice transformer for legacy support.

This commit is contained in:
Romano Schoonheim 2021-01-07 12:30:46 -08:00
parent dfa0b6505d
commit 498a71fc71
4 changed files with 42 additions and 9 deletions

View File

@ -10,9 +10,9 @@ LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=example_app
DB_DATABASE=simple_home
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=toor
BROADCAST_DRIVER=log
CACHE_DRIVER=file
@ -22,7 +22,7 @@ SESSION_LIFETIME=120
MEMCACHED_HOST=memcached
REDIS_HOST=127.0.0.1
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

View File

@ -1,8 +1,8 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_KEY=base64:xVtSpoWE/jaVTqvkBLSMsqTmkLc6GXTZ/1Hu5t2tIww=
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=http://example-app.test
LOG_CHANNEL=stack
LOG_LEVEL=debug
@ -10,9 +10,9 @@ LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=example_app
DB_DATABASE=simple_home
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=toor
BROADCAST_DRIVER=log
CACHE_DRIVER=file

View 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"
];
}
}

View File

@ -27,8 +27,6 @@ services:
# - '/dev/shm:/dev/shm'
# networks:
# - sail
# depends_on:
# - laravel.test
mysql:
image: 'mysql:8.0'
ports: