big restructure
This commit is contained in:
25
lib/Repository/Content/PageRepository.php
Normal file
25
lib/Repository/Content/PageRepository.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Content;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class PageRepository
|
||||
{
|
||||
private static function unwrap(?array $row): ?array
|
||||
{
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
return $row['pages'] ?? $row;
|
||||
}
|
||||
|
||||
public static function findBySlug(string $slug): ?array
|
||||
{
|
||||
$row = DB::selectOne(
|
||||
'select id, uuid, slug, created_by, modified_by, created, modified from pages where slug = ? limit 1',
|
||||
$slug
|
||||
);
|
||||
return self::unwrap($row);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user