Defice transformer for legacy support.
This commit is contained in:
parent
dfa0b6505d
commit
498a71fc71
6
.env.bak
6
.env.bak
@ -10,9 +10,9 @@ LOG_LEVEL=debug
|
|||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=mysql
|
DB_HOST=mysql
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_DATABASE=example_app
|
DB_DATABASE=simple_home
|
||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=toor
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
@ -22,7 +22,7 @@ SESSION_LIFETIME=120
|
|||||||
|
|
||||||
MEMCACHED_HOST=memcached
|
MEMCACHED_HOST=memcached
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
REDIS_HOST=redis
|
||||||
REDIS_PASSWORD=null
|
REDIS_PASSWORD=null
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
APP_NAME=Laravel
|
APP_NAME=Laravel
|
||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_KEY=
|
APP_KEY=base64:xVtSpoWE/jaVTqvkBLSMsqTmkLc6GXTZ/1Hu5t2tIww=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_URL=http://localhost
|
APP_URL=http://example-app.test
|
||||||
|
|
||||||
LOG_CHANNEL=stack
|
LOG_CHANNEL=stack
|
||||||
LOG_LEVEL=debug
|
LOG_LEVEL=debug
|
||||||
@ -10,9 +10,9 @@ LOG_LEVEL=debug
|
|||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=mysql
|
DB_HOST=mysql
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_DATABASE=example_app
|
DB_DATABASE=simple_home
|
||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=toor
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
|
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"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -27,8 +27,6 @@ services:
|
|||||||
# - '/dev/shm:/dev/shm'
|
# - '/dev/shm:/dev/shm'
|
||||||
# networks:
|
# networks:
|
||||||
# - sail
|
# - sail
|
||||||
# depends_on:
|
|
||||||
# - laravel.test
|
|
||||||
mysql:
|
mysql:
|
||||||
image: 'mysql:8.0'
|
image: 'mysql:8.0'
|
||||||
ports:
|
ports:
|
||||||
|
Loading…
Reference in New Issue
Block a user