23 lines
509 B
PHP
23 lines
509 B
PHP
<?php namespace Lucent\Core\Repository;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Lucent\Core\Data\Edge;
|
|
use Lucent\Core\Edge\EdgeModule;
|
|
|
|
class EdgeRepo
|
|
{
|
|
const TABLE_NAME = "edges";
|
|
|
|
/**
|
|
* Insert multiple edges into the database.
|
|
*
|
|
* @param Edge[] $edges An array of Edge objects to be inserted.
|
|
*/
|
|
public static function insertMany(array $edges): void
|
|
{
|
|
DB::table(self::TABLE_NAME)->insert(
|
|
array_map(EdgeModule::toDb(...), $edges),
|
|
);
|
|
}
|
|
}
|