| 1 |
<?php |
| 2 |
/** |
| 3 |
* Repository Interface |
| 4 |
* |
| 5 |
* @package Easy_Invoice |
| 6 |
* @subpackage Interfaces |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace EasyInvoice\Interfaces; |
| 10 |
|
| 11 |
/** |
| 12 |
* Repository Interface |
| 13 |
* |
| 14 |
* Defines the contract for repository classes. |
| 15 |
*/ |
| 16 |
interface RepositoryInterface { |
| 17 |
/** |
| 18 |
* Find a model by ID |
| 19 |
* |
| 20 |
* @param int $id The ID to find |
| 21 |
* @return mixed The model or null if not found |
| 22 |
*/ |
| 23 |
public function find($id); |
| 24 |
|
| 25 |
/** |
| 26 |
* Get all models |
| 27 |
* |
| 28 |
* @param array $args Optional arguments to filter the results |
| 29 |
* @return array Array of models |
| 30 |
*/ |
| 31 |
public function all($args = []); |
| 32 |
|
| 33 |
/** |
| 34 |
* Create a new model |
| 35 |
* |
| 36 |
* @param array $data The data to create the model with |
| 37 |
* @return mixed The created model |
| 38 |
*/ |
| 39 |
public function create($data); |
| 40 |
|
| 41 |
/** |
| 42 |
* Update an existing model |
| 43 |
* |
| 44 |
* @param int $id The ID of the model to update |
| 45 |
* @param array $data The data to update the model with |
| 46 |
* @return mixed The updated model |
| 47 |
*/ |
| 48 |
public function update($id, $data); |
| 49 |
|
| 50 |
/** |
| 51 |
* Delete a model |
| 52 |
* |
| 53 |
* @param int $id The ID of the model to delete |
| 54 |
* @return bool True if successful, false otherwise |
| 55 |
*/ |
| 56 |
public function delete($id); |
| 57 |
|
| 58 |
/** |
| 59 |
* Count models |
| 60 |
* |
| 61 |
* @param array $args Optional arguments to filter the results |
| 62 |
* @return int The count of models |
| 63 |
*/ |
| 64 |
public function count($args = []); |
| 65 |
} |