extend Post entity with feature slot
Adds nullable feature_slot column (unique) plus repo findByFeatureSlot/findFeatured/update methods so admins can pin a post into one of two slots.
This commit is contained in:
parent
64a334c63e
commit
f73e5a1af5
6 changed files with 160 additions and 4 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Post;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
interface PostRepository
|
||||
{
|
||||
public function create(CreatePostDto $dto): Post;
|
||||
|
|
@ -19,4 +21,16 @@ interface PostRepository
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue