field create

This commit is contained in:
2026-01-08 13:10:18 +02:00
parent 4d2497d96f
commit ebccac210a
15 changed files with 318 additions and 18 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php namespace Lucent\Core\Repository;
use Illuminate\Support\Facades\DB;
use Lucent\Core\Schema\Data\Field;
use Lucent\Core\Schema\FieldModule;
use Lucent\Core\Schema\SchemaModule;
class FieldRepo
{
const TABLE_NAME = "fields";
/**
* @@return Field[]
*/
public static function all(): array
{
return DB::table(self::TABLE_NAME)
->orderBy("name")
->get()
->map(SchemaModule::fromDb(...))
->toArray();
}
public static function insert(Field $field): void
{
DB::table(self::TABLE_NAME)->insert(FieldModule::toDb($field));
}
}