Adds nullable feature_slot column (unique) plus repo findByFeatureSlot/findFeatured/update methods so admins can pin a post into one of two slots.
36 lines
639 B
PHP
36 lines
639 B
PHP
<?php
|
|
|
|
namespace App\Post;
|
|
|
|
use RuntimeException;
|
|
|
|
interface PostRepository
|
|
{
|
|
public function create(CreatePostDto $dto): Post;
|
|
|
|
public function find(int $id): ?Post;
|
|
|
|
/**
|
|
* @return Post[]
|
|
*/
|
|
public function findByUserId(int $userId): array;
|
|
|
|
/**
|
|
* @return Post[]
|
|
*/
|
|
public function findRecent(int $limit): array;
|
|
|
|
public function delete(int $id): void;
|
|
|
|
/**
|
|
* @throws RuntimeException
|
|
*/
|
|
public function update(Post $post): Post;
|
|
|
|
public function findByFeatureSlot(int $slot): ?Post;
|
|
|
|
/**
|
|
* @return Post[]
|
|
*/
|
|
public function findFeatured(): array;
|
|
}
|