diff --git a/front/views/records/table.blade.php b/front/views/records/table.blade.php
index 519cd64..e9d72ad 100644
--- a/front/views/records/table.blade.php
+++ b/front/views/records/table.blade.php
@@ -1,7 +1,3 @@
-@php
-
- @endphp
-
@@ -11,6 +7,7 @@
@endif
+
@foreach($schema->visible as $visibleColumn)
@php
$schemaField = $schema->fields->firstWhere("name", $visibleColumn);
diff --git a/src/Commands/GenerateFileSchema.php b/src/Commands/GenerateFileSchema.php
index 56673af..583594f 100644
--- a/src/Commands/GenerateFileSchema.php
+++ b/src/Commands/GenerateFileSchema.php
@@ -20,6 +20,7 @@ class GenerateFileSchema extends Command
$schema = new FilesSchema(
name: $name,
label: $name,
+ visible: [],
fields: Collection::make(),
disk: "lucent",
path: $name,
diff --git a/src/Http/Controller/RecordController.php b/src/Http/Controller/RecordController.php
index f02135d..186a361 100644
--- a/src/Http/Controller/RecordController.php
+++ b/src/Http/Controller/RecordController.php
@@ -16,6 +16,7 @@ use Lucent\Record\Manager;
use Lucent\Record\QueryRecord;
use Lucent\Record\RecordService;
use Lucent\Record\Status;
+use Lucent\Schema\SchemaService;
use Lucent\Schema\System;
use Lucent\Schema\Validator\ValidatorException;
use Lucent\Svelte\Svelte;
@@ -26,6 +27,7 @@ class RecordController extends Controller
{
public function __construct(
private readonly RecordService $recordService,
+ private readonly SchemaService $schemaService,
private readonly AccountService $accountService,
private readonly ChannelService $channelService,
private readonly Svelte $svelte,
@@ -79,15 +81,13 @@ class RecordController extends Controller
->runWithCount();
-
-
$data = [
"schemas" => $this->channelService->channel->schemas,
"schema" => $schema,
"users" => $users,
"records" => $graph->tree(),
"graph" => toArray($graph),
- "visibleFields" => array_values(System::list()),
+ "visibleFields" => $this->schemaService->getVisibleFields($schema),
"systemFields" => array_values(System::list()),
"operators" => $this->operatorRegistry->all(),
"sortParam" => $sort,
diff --git a/src/Schema/CollectionSchema.php b/src/Schema/CollectionSchema.php
index 8d130aa..8edaa23 100644
--- a/src/Schema/CollectionSchema.php
+++ b/src/Schema/CollectionSchema.php
@@ -30,4 +30,6 @@ class CollectionSchema implements Schema
{
}
+
+
}
diff --git a/src/Schema/FilesSchema.php b/src/Schema/FilesSchema.php
index 7605ba4..84630a1 100644
--- a/src/Schema/FilesSchema.php
+++ b/src/Schema/FilesSchema.php
@@ -16,6 +16,7 @@ class FilesSchema implements Schema
function __construct(
public string $name,
public string $label,
+ public array $visible,
public Collection $fields,
public string $disk,
public string $path,
diff --git a/src/Schema/SchemaService.php b/src/Schema/SchemaService.php
index 689c643..96c72cf 100644
--- a/src/Schema/SchemaService.php
+++ b/src/Schema/SchemaService.php
@@ -35,6 +35,7 @@ class SchemaService
"files" => new FilesSchema(
name: $schemaArr["name"],
label: $schemaArr["label"],
+ visible: $schemaArr["visible"] ?? [],
fields: (new Collection($schemaArr["fields"]))->map([$this, 'mapFields']),
disk: $schemaArr["disk"] ?? "lucent",
path: $schemaArr["path"] ?? $schemaArr["name"],
@@ -82,4 +83,8 @@ class SchemaService
return new $ui(...$field);
}
+
+ public function getVisibleFields(Schema $schema):array{
+ return $schema->fields->whereIn("name",$schema->visible)->filter()->toArray();
+ }
}