| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Yatra\Contracts; |
| 6 |
|
| 7 |
/** |
| 8 |
* Repository Interface |
| 9 |
* |
| 10 |
* Defines standard contract for all repository classes |
| 11 |
*/ |
| 12 |
interface RepositoryInterface |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Find record by ID |
| 16 |
*/ |
| 17 |
public function find(int $id): ?\stdClass; |
| 18 |
|
| 19 |
/** |
| 20 |
* Get all records with optional filters |
| 21 |
*/ |
| 22 |
public function all(array $filters = []): array; |
| 23 |
|
| 24 |
/** |
| 25 |
* Create new record |
| 26 |
*/ |
| 27 |
public function create(array $data): int; |
| 28 |
|
| 29 |
/** |
| 30 |
* Update existing record |
| 31 |
*/ |
| 32 |
public function update(int $id, array $data): bool; |
| 33 |
|
| 34 |
/** |
| 35 |
* Delete record |
| 36 |
*/ |
| 37 |
public function delete(int $id): bool; |
| 38 |
|
| 39 |
/** |
| 40 |
* Count records with optional filters |
| 41 |
*/ |
| 42 |
public function count(array $filters = []): int; |
| 43 |
|
| 44 |
/** |
| 45 |
* Check if record exists |
| 46 |
*/ |
| 47 |
public function exists(int $id): bool; |
| 48 |
|
| 49 |
/** |
| 50 |
* Get paginated results |
| 51 |
*/ |
| 52 |
public function paginate(int $page = 1, int $perPage = 10, array $filters = []): array; |
| 53 |
} |
| 54 |
|