@@ -8,127 +8,127 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface BaseServiceInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Fetch records with relations based on the given params. |
|
| 13 | - * |
|
| 14 | - * @param string $local |
|
| 15 | - * @param array $relations |
|
| 16 | - * @param array $conditions |
|
| 17 | - * @param int $perPage |
|
| 18 | - * @param string $sortBy |
|
| 19 | - * @param bool $desc |
|
| 20 | - * @param bool $trashed |
|
| 21 | - * @return LengthAwarePaginator |
|
| 22 | - */ |
|
| 11 | + /** |
|
| 12 | + * Fetch records with relations based on the given params. |
|
| 13 | + * |
|
| 14 | + * @param string $local |
|
| 15 | + * @param array $relations |
|
| 16 | + * @param array $conditions |
|
| 17 | + * @param int $perPage |
|
| 18 | + * @param string $sortBy |
|
| 19 | + * @param bool $desc |
|
| 20 | + * @param bool $trashed |
|
| 21 | + * @return LengthAwarePaginator |
|
| 22 | + */ |
|
| 23 | 23 | public function list(string $local, array $relations = [], array $conditions = [], int $perPage = 15, string $sortBy = 'created_at', bool $desc = true, bool $trashed = false): LengthAwarePaginator; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Fetch all records with relations from the storage. |
|
| 27 | - * |
|
| 28 | - * @param array $relations |
|
| 29 | - * @param string $sortBy |
|
| 30 | - * @param boolean $desc |
|
| 31 | - * @param array $columns |
|
| 32 | - * @return collection |
|
| 33 | - */ |
|
| 25 | + /** |
|
| 26 | + * Fetch all records with relations from the storage. |
|
| 27 | + * |
|
| 28 | + * @param array $relations |
|
| 29 | + * @param string $sortBy |
|
| 30 | + * @param boolean $desc |
|
| 31 | + * @param array $columns |
|
| 32 | + * @return collection |
|
| 33 | + */ |
|
| 34 | 34 | public function all(array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): Collection; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Fetch all records with relations from storage in pages. |
|
| 38 | - * |
|
| 39 | - * @param integer $perPage |
|
| 40 | - * @param array $relations |
|
| 41 | - * @param array $sortBy |
|
| 42 | - * @param array $desc |
|
| 43 | - * @param array $columns |
|
| 44 | - * @return LengthAwarePaginator |
|
| 45 | - */ |
|
| 36 | + /** |
|
| 37 | + * Fetch all records with relations from storage in pages. |
|
| 38 | + * |
|
| 39 | + * @param integer $perPage |
|
| 40 | + * @param array $relations |
|
| 41 | + * @param array $sortBy |
|
| 42 | + * @param array $desc |
|
| 43 | + * @param array $columns |
|
| 44 | + * @return LengthAwarePaginator |
|
| 45 | + */ |
|
| 46 | 46 | public function paginate(int $perPage = 15, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator; |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Fetch all records with relations based on |
|
| 50 | - * the given condition from storage in pages. |
|
| 51 | - * |
|
| 52 | - * @param array $conditions array of conditions |
|
| 53 | - * @param integer $perPage |
|
| 54 | - * @param array $relations |
|
| 55 | - * @param array $sortBy |
|
| 56 | - * @param array $desc |
|
| 57 | - * @param array $columns |
|
| 58 | - * @return collection |
|
| 59 | - */ |
|
| 48 | + /** |
|
| 49 | + * Fetch all records with relations based on |
|
| 50 | + * the given condition from storage in pages. |
|
| 51 | + * |
|
| 52 | + * @param array $conditions array of conditions |
|
| 53 | + * @param integer $perPage |
|
| 54 | + * @param array $relations |
|
| 55 | + * @param array $sortBy |
|
| 56 | + * @param array $desc |
|
| 57 | + * @param array $columns |
|
| 58 | + * @return collection |
|
| 59 | + */ |
|
| 60 | 60 | public function paginateBy(array $conditions, int $perPage = 15, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator; |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Save the given model/models to the storage. |
|
| 64 | - * |
|
| 65 | - * @param array $data |
|
| 66 | - * @return Model |
|
| 67 | - */ |
|
| 62 | + /** |
|
| 63 | + * Save the given model/models to the storage. |
|
| 64 | + * |
|
| 65 | + * @param array $data |
|
| 66 | + * @return Model |
|
| 67 | + */ |
|
| 68 | 68 | public function save(array $data): Model; |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Delete record from the storage based on the given |
|
| 72 | - * condition. |
|
| 73 | - * |
|
| 74 | - * @param string $value condition value |
|
| 75 | - * @param string $attribute condition column name |
|
| 76 | - * @return bool |
|
| 77 | - */ |
|
| 70 | + /** |
|
| 71 | + * Delete record from the storage based on the given |
|
| 72 | + * condition. |
|
| 73 | + * |
|
| 74 | + * @param string $value condition value |
|
| 75 | + * @param string $attribute condition column name |
|
| 76 | + * @return bool |
|
| 77 | + */ |
|
| 78 | 78 | public function delete(string $value, string $attribute = 'id'): bool; |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Fetch records from the storage based on the given |
|
| 82 | - * id. |
|
| 83 | - * |
|
| 84 | - * @param int $id |
|
| 85 | - * @param array $relations |
|
| 86 | - * @param array $columns |
|
| 87 | - * @return object |
|
| 88 | - */ |
|
| 80 | + /** |
|
| 81 | + * Fetch records from the storage based on the given |
|
| 82 | + * id. |
|
| 83 | + * |
|
| 84 | + * @param int $id |
|
| 85 | + * @param array $relations |
|
| 86 | + * @param array $columns |
|
| 87 | + * @return object |
|
| 88 | + */ |
|
| 89 | 89 | public function find(int $id, array $relations = [], array $columns = ['*']): Model; |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Fetch records from the storage based on the given |
|
| 93 | - * condition. |
|
| 94 | - * |
|
| 95 | - * @param array $conditions array of conditions |
|
| 96 | - * @param array $relations |
|
| 97 | - * @param array $sortBy |
|
| 98 | - * @param array $desc |
|
| 99 | - * @param array $columns |
|
| 100 | - * @return collection |
|
| 101 | - */ |
|
| 91 | + /** |
|
| 92 | + * Fetch records from the storage based on the given |
|
| 93 | + * condition. |
|
| 94 | + * |
|
| 95 | + * @param array $conditions array of conditions |
|
| 96 | + * @param array $relations |
|
| 97 | + * @param array $sortBy |
|
| 98 | + * @param array $desc |
|
| 99 | + * @param array $columns |
|
| 100 | + * @return collection |
|
| 101 | + */ |
|
| 102 | 102 | public function findBy(array $conditions, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): Collection; |
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Fetch the first record fro the storage based on the given |
|
| 106 | - * condition. |
|
| 107 | - * |
|
| 108 | - * @param array $conditions array of conditions |
|
| 109 | - * @param array $relations |
|
| 110 | - * @param array $columns |
|
| 111 | - * @return Model |
|
| 112 | - */ |
|
| 104 | + /** |
|
| 105 | + * Fetch the first record fro the storage based on the given |
|
| 106 | + * condition. |
|
| 107 | + * |
|
| 108 | + * @param array $conditions array of conditions |
|
| 109 | + * @param array $relations |
|
| 110 | + * @param array $columns |
|
| 111 | + * @return Model |
|
| 112 | + */ |
|
| 113 | 113 | public function first(array $conditions, array $relations = [], array $columns = ['*']): Model; |
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Return the deleted models in pages based on the given conditions. |
|
| 117 | - * |
|
| 118 | - * @param array $conditions array of conditions |
|
| 119 | - * @param int $perPage |
|
| 120 | - * @param string $sortBy |
|
| 121 | - * @param bool $desc |
|
| 122 | - * @param array $columns |
|
| 123 | - * @return LengthAwarePaginator |
|
| 124 | - */ |
|
| 115 | + /** |
|
| 116 | + * Return the deleted models in pages based on the given conditions. |
|
| 117 | + * |
|
| 118 | + * @param array $conditions array of conditions |
|
| 119 | + * @param int $perPage |
|
| 120 | + * @param string $sortBy |
|
| 121 | + * @param bool $desc |
|
| 122 | + * @param array $columns |
|
| 123 | + * @return LengthAwarePaginator |
|
| 124 | + */ |
|
| 125 | 125 | public function deleted(array $conditions, int $perPage = 15, string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator; |
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Restore the deleted model. |
|
| 129 | - * |
|
| 130 | - * @param int $id |
|
| 131 | - * @return bool |
|
| 132 | - */ |
|
| 127 | + /** |
|
| 128 | + * Restore the deleted model. |
|
| 129 | + * |
|
| 130 | + * @param int $id |
|
| 131 | + * @return bool |
|
| 132 | + */ |
|
| 133 | 133 | public function restore(int $id): bool; |
| 134 | 134 | } |
@@ -8,138 +8,138 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface BaseRepositoryInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Fetch all records with relations from the storage. |
|
| 13 | - * |
|
| 14 | - * @param array $relations |
|
| 15 | - * @param string $sortBy |
|
| 16 | - * @param bool $desc |
|
| 17 | - * @param array $columns |
|
| 18 | - * @return collection |
|
| 19 | - */ |
|
| 11 | + /** |
|
| 12 | + * Fetch all records with relations from the storage. |
|
| 13 | + * |
|
| 14 | + * @param array $relations |
|
| 15 | + * @param string $sortBy |
|
| 16 | + * @param bool $desc |
|
| 17 | + * @param array $columns |
|
| 18 | + * @return collection |
|
| 19 | + */ |
|
| 20 | 20 | public function all(array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): Collection; |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Fetch all records with relations from storage in pages. |
|
| 24 | - * |
|
| 25 | - * @param int $perPage |
|
| 26 | - * @param array $relations |
|
| 27 | - * @param string $sortBy |
|
| 28 | - * @param bool $desc |
|
| 29 | - * @param array $columns |
|
| 30 | - * @return LengthAwarePaginator |
|
| 31 | - */ |
|
| 22 | + /** |
|
| 23 | + * Fetch all records with relations from storage in pages. |
|
| 24 | + * |
|
| 25 | + * @param int $perPage |
|
| 26 | + * @param array $relations |
|
| 27 | + * @param string $sortBy |
|
| 28 | + * @param bool $desc |
|
| 29 | + * @param array $columns |
|
| 30 | + * @return LengthAwarePaginator |
|
| 31 | + */ |
|
| 32 | 32 | public function paginate(int $perPage = 15, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Fetch all records with relations based on |
|
| 36 | - * the given condition from storage in pages. |
|
| 37 | - * |
|
| 38 | - * @param array $conditions array of conditions |
|
| 39 | - * @param integer $perPage |
|
| 40 | - * @param array $relations |
|
| 41 | - * @param array $sortBy |
|
| 42 | - * @param array $desc |
|
| 43 | - * @param array $columns |
|
| 44 | - * @return collection |
|
| 45 | - */ |
|
| 34 | + /** |
|
| 35 | + * Fetch all records with relations based on |
|
| 36 | + * the given condition from storage in pages. |
|
| 37 | + * |
|
| 38 | + * @param array $conditions array of conditions |
|
| 39 | + * @param integer $perPage |
|
| 40 | + * @param array $relations |
|
| 41 | + * @param array $sortBy |
|
| 42 | + * @param array $desc |
|
| 43 | + * @param array $columns |
|
| 44 | + * @return collection |
|
| 45 | + */ |
|
| 46 | 46 | public function paginateBy(array $conditions, int $perPage = 15, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator; |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Count all records based on the given condition from storage. |
|
| 50 | - * |
|
| 51 | - * @param array $conditions array of conditions |
|
| 52 | - * @return int |
|
| 53 | - */ |
|
| 48 | + /** |
|
| 49 | + * Count all records based on the given condition from storage. |
|
| 50 | + * |
|
| 51 | + * @param array $conditions array of conditions |
|
| 52 | + * @return int |
|
| 53 | + */ |
|
| 54 | 54 | public function count(array $conditions = []): int; |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Pluck column based on the given condition from storage. |
|
| 58 | - * |
|
| 59 | - * @param array $conditions array of conditions |
|
| 60 | - * @param string $column |
|
| 61 | - * @return collection |
|
| 62 | - */ |
|
| 56 | + /** |
|
| 57 | + * Pluck column based on the given condition from storage. |
|
| 58 | + * |
|
| 59 | + * @param array $conditions array of conditions |
|
| 60 | + * @param string $column |
|
| 61 | + * @return collection |
|
| 62 | + */ |
|
| 63 | 63 | public function pluck(array $conditions, string $column): Collection; |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Save the given model to the storage. |
|
| 67 | - * |
|
| 68 | - * @param array $data |
|
| 69 | - * @return Model |
|
| 70 | - */ |
|
| 65 | + /** |
|
| 66 | + * Save the given model to the storage. |
|
| 67 | + * |
|
| 68 | + * @param array $data |
|
| 69 | + * @return Model |
|
| 70 | + */ |
|
| 71 | 71 | public function save(array $data): Model; |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Insert the given model/models to the storage. |
|
| 75 | - * |
|
| 76 | - * @param array $data |
|
| 77 | - * @return bool |
|
| 78 | - */ |
|
| 73 | + /** |
|
| 74 | + * Insert the given model/models to the storage. |
|
| 75 | + * |
|
| 76 | + * @param array $data |
|
| 77 | + * @return bool |
|
| 78 | + */ |
|
| 79 | 79 | public function insert(array $data): bool; |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Delete record from the storage based on the given |
|
| 83 | - * condition. |
|
| 84 | - * |
|
| 85 | - * @param string $value condition value |
|
| 86 | - * @param string $attribute condition column name |
|
| 87 | - * @return bool |
|
| 88 | - */ |
|
| 81 | + /** |
|
| 82 | + * Delete record from the storage based on the given |
|
| 83 | + * condition. |
|
| 84 | + * |
|
| 85 | + * @param string $value condition value |
|
| 86 | + * @param string $attribute condition column name |
|
| 87 | + * @return bool |
|
| 88 | + */ |
|
| 89 | 89 | public function delete(string $value, string $attribute = 'id'): bool; |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Fetch records from the storage based on the given |
|
| 93 | - * id. |
|
| 94 | - * |
|
| 95 | - * @param int $id |
|
| 96 | - * @param array $relations |
|
| 97 | - * @param array $columns |
|
| 98 | - * @return Model |
|
| 99 | - */ |
|
| 91 | + /** |
|
| 92 | + * Fetch records from the storage based on the given |
|
| 93 | + * id. |
|
| 94 | + * |
|
| 95 | + * @param int $id |
|
| 96 | + * @param array $relations |
|
| 97 | + * @param array $columns |
|
| 98 | + * @return Model |
|
| 99 | + */ |
|
| 100 | 100 | public function find(int $id, array $relations = [], array $columns = ['*']): Model; |
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Fetch records from the storage based on the given |
|
| 104 | - * condition. |
|
| 105 | - * |
|
| 106 | - * @param array $conditions array of conditions |
|
| 107 | - * @param array $relations |
|
| 108 | - * @param string $sortBy |
|
| 109 | - * @param bool $desc |
|
| 110 | - * @param array $columns |
|
| 111 | - * @return collection |
|
| 112 | - */ |
|
| 102 | + /** |
|
| 103 | + * Fetch records from the storage based on the given |
|
| 104 | + * condition. |
|
| 105 | + * |
|
| 106 | + * @param array $conditions array of conditions |
|
| 107 | + * @param array $relations |
|
| 108 | + * @param string $sortBy |
|
| 109 | + * @param bool $desc |
|
| 110 | + * @param array $columns |
|
| 111 | + * @return collection |
|
| 112 | + */ |
|
| 113 | 113 | public function findBy(array $conditions, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): Collection; |
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Fetch the first record fro the storage based on the given |
|
| 117 | - * condition. |
|
| 118 | - * |
|
| 119 | - * @param array $conditions array of conditions |
|
| 120 | - * @param array $relations |
|
| 121 | - * @param array $columns |
|
| 122 | - * @return Model |
|
| 123 | - */ |
|
| 115 | + /** |
|
| 116 | + * Fetch the first record fro the storage based on the given |
|
| 117 | + * condition. |
|
| 118 | + * |
|
| 119 | + * @param array $conditions array of conditions |
|
| 120 | + * @param array $relations |
|
| 121 | + * @param array $columns |
|
| 122 | + * @return Model |
|
| 123 | + */ |
|
| 124 | 124 | public function first(array $conditions, array $relations = [], array $columns = ['*']): Model; |
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * Return the deleted models in pages based on the given conditions. |
|
| 128 | - * |
|
| 129 | - * @param array $conditions array of conditions |
|
| 130 | - * @param int $perPage |
|
| 131 | - * @param string $sortBy |
|
| 132 | - * @param bool $desc |
|
| 133 | - * @param array $columns |
|
| 134 | - * @return LengthAwarePaginator |
|
| 135 | - */ |
|
| 126 | + /** |
|
| 127 | + * Return the deleted models in pages based on the given conditions. |
|
| 128 | + * |
|
| 129 | + * @param array $conditions array of conditions |
|
| 130 | + * @param int $perPage |
|
| 131 | + * @param string $sortBy |
|
| 132 | + * @param bool $desc |
|
| 133 | + * @param array $columns |
|
| 134 | + * @return LengthAwarePaginator |
|
| 135 | + */ |
|
| 136 | 136 | public function deleted(array $conditions, int $perPage = 15, string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator; |
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * Restore the deleted model. |
|
| 140 | - * |
|
| 141 | - * @param int $id |
|
| 142 | - * @return bool |
|
| 143 | - */ |
|
| 138 | + /** |
|
| 139 | + * Restore the deleted model. |
|
| 140 | + * |
|
| 141 | + * @param int $id |
|
| 142 | + * @return bool |
|
| 143 | + */ |
|
| 144 | 144 | public function restore(int $id): bool; |
| 145 | 145 | } |