Files
lucent-laravel/src/Core/Repository/SchemaRepo.php
T

28 lines
605 B
PHP
Raw Normal View History

2026-01-07 23:49:55 +02:00
<?php namespace Lucent\Core\Repository;
use Illuminate\Support\Facades\DB;
use Lucent\Core\Schema\Data\Schema;
use Lucent\Core\Schema\SchemaModule;
class SchemaRepo
{
const TABLE_NAME = "schemas";
/**
* @@return Schema[]
*/
public static function all(): array
{
return DB::table(self::TABLE_NAME)
->orderBy("name")
->get()
->map(SchemaModule::fromDb(...))
->toArray();
}
public static function insert(Schema $schema): void
{
DB::table(self::TABLE_NAME)->insert(SchemaModule::toDb($schema));
}
}