edges wip
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Lucent\Core\Data\Record;
|
||||
use Lucent\Core\Data\RecordField;
|
||||
use Lucent\Core\Data\RecordPreview;
|
||||
use Lucent\Core\Data\RecordStatus;
|
||||
use stdClass;
|
||||
|
||||
@@ -27,6 +27,7 @@ class RecordModule
|
||||
return [
|
||||
"id" => $record->id,
|
||||
"schema_id" => $record->schemaId,
|
||||
"title_field_id" => $record->titleFieldId,
|
||||
"created_at" => $record->createdAt->toJSON(),
|
||||
"created_by" => $record->createdBy,
|
||||
"published_at" => empty($record->publishedAt)
|
||||
@@ -49,6 +50,7 @@ class RecordModule
|
||||
return new Record(
|
||||
id: data_get($data, "id"),
|
||||
schemaId: data_get($data, "schema_id"),
|
||||
titleFieldId: data_get($data, "title_field_id"),
|
||||
createdAt: Carbon::parse(data_get($data, "created_at")),
|
||||
createdBy: data_get($data, "created_by"),
|
||||
publishedAt: empty(data_get($data, "published_at"))
|
||||
@@ -65,4 +67,13 @@ class RecordModule
|
||||
trashedBy: data_get($data, "trashed_by"),
|
||||
);
|
||||
}
|
||||
|
||||
public static function recordPreviewFromDb(stdClass $data): RecordPreview
|
||||
{
|
||||
return new RecordPreview(
|
||||
id: data_get($data, "id"),
|
||||
schemaId: data_get($data, "schema_id"),
|
||||
title: data_get($data, "title"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user