|
26 | 26 |
|
27 | 27 | interface RepositoryInterface |
28 | 28 | { |
| 29 | + /** |
| 30 | + * Return an identifier or Model object to be used by the repository. |
| 31 | + * |
| 32 | + * @return string|\Closure|object |
| 33 | + */ |
29 | 34 | public function model(); |
30 | 35 |
|
| 36 | + /** |
| 37 | + * Return the model being used for this repository instance. |
| 38 | + * |
| 39 | + * @return mixed |
| 40 | + */ |
31 | 41 | public function getModel(); |
32 | 42 |
|
| 43 | + /** |
| 44 | + * Returns an instance of a query builder. |
| 45 | + * |
| 46 | + * @return mixed |
| 47 | + */ |
33 | 48 | public function getBuilder(); |
34 | 49 |
|
| 50 | + /** |
| 51 | + * Returns the colummns to be selected or returned by the query. |
| 52 | + * |
| 53 | + * @return mixed |
| 54 | + */ |
35 | 55 | public function getColumns(); |
36 | 56 |
|
| 57 | + /** |
| 58 | + * An array of columns to filter the response by. |
| 59 | + * |
| 60 | + * @param array $columns |
| 61 | + * @return $this |
| 62 | + */ |
37 | 63 | public function withColumns($columns = ['*']); |
38 | 64 |
|
39 | | - public function create($fields); |
| 65 | + /** |
| 66 | + * Disable returning a fresh model when data is inserted or updated. |
| 67 | + * |
| 68 | + * @return $this |
| 69 | + */ |
| 70 | + public function withoutFresh(); |
40 | 71 |
|
| 72 | + /** |
| 73 | + * Create a new model instance and persist it to the database. |
| 74 | + * |
| 75 | + * @param array $fields |
| 76 | + * @param bool $validate |
| 77 | + * @return mixed |
| 78 | + * |
| 79 | + * @throws \Pterodactyl\Exceptions\Model\DataValidationException |
| 80 | + */ |
| 81 | + public function create(array $fields, $validate = true); |
| 82 | + |
| 83 | + /** |
| 84 | + * Delete a given record from the database. |
| 85 | + * |
| 86 | + * @param int $id |
| 87 | + * @return bool|null |
| 88 | + */ |
41 | 89 | public function delete($id); |
42 | 90 |
|
| 91 | + /** |
| 92 | + * Find a model that has the specific ID passed. |
| 93 | + * |
| 94 | + * @param int $id |
| 95 | + * @return mixed |
| 96 | + * |
| 97 | + * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException |
| 98 | + */ |
43 | 99 | public function find($id); |
44 | 100 |
|
45 | | - public function findWhere($fields); |
| 101 | + /** |
| 102 | + * Find a model matching an array of where clauses. |
| 103 | + * |
| 104 | + * @param array $fields |
| 105 | + * @return mixed |
| 106 | + * |
| 107 | + * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException |
| 108 | + */ |
| 109 | + public function findWhere(array $fields); |
46 | 110 |
|
47 | | - public function update($id, $fields); |
| 111 | + /** |
| 112 | + * Update a given ID with the passed array of fields. |
| 113 | + * |
| 114 | + * @param int $id |
| 115 | + * @param array $fields |
| 116 | + * @param bool $validate |
| 117 | + * @param bool $force |
| 118 | + * @return mixed |
| 119 | + * |
| 120 | + * @throws \Pterodactyl\Exceptions\Model\DataValidationException |
| 121 | + * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException |
| 122 | + */ |
| 123 | + public function update($id, array $fields, $validate = true, $force = false); |
48 | 124 |
|
49 | | - public function massUpdate($fields); |
| 125 | + /** |
| 126 | + * Update multiple records matching the passed clauses. |
| 127 | + * |
| 128 | + * @param array $where |
| 129 | + * @param array $fields |
| 130 | + * @return mixed |
| 131 | + */ |
| 132 | + public function massUpdate(array $where, array $fields); |
50 | 133 | } |
0 commit comments