schemas and fields
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user