| @@ 228-242 (lines=15) @@ | ||
| 225 | * @param string $field |
|
| 226 | * @return bool |
|
| 227 | */ |
|
| 228 | public function delete( $value = null, $field = 'id' ) |
|
| 229 | { |
|
| 230 | $this->applyCriteria(); |
|
| 231 | ||
| 232 | if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->delete(); |
|
| 233 | else |
|
| 234 | { |
|
| 235 | if ( !empty( $this->criteria ) ) $result = $this->model->delete(); |
|
| 236 | else $result = FALSE; |
|
| 237 | } |
|
| 238 | ||
| 239 | $this->resetScope(); |
|
| 240 | ||
| 241 | return (bool)$result; |
|
| 242 | } |
|
| 243 | ||
| 244 | /** |
|
| 245 | * @return mixed |
|
| @@ 273-287 (lines=15) @@ | ||
| 270 | * @param string $field |
|
| 271 | * @return mixed |
|
| 272 | */ |
|
| 273 | public function destroy($value = null, $field = 'id') |
|
| 274 | { |
|
| 275 | $this->applyCriteria(); |
|
| 276 | ||
| 277 | if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->forceDelete(); |
|
| 278 | else |
|
| 279 | { |
|
| 280 | if ( !empty( $this->criteria ) ) $result = $this->model->forceDelete(); |
|
| 281 | else $result = FALSE; |
|
| 282 | } |
|
| 283 | ||
| 284 | $this->resetScope(); |
|
| 285 | ||
| 286 | return (bool)$result; |
|
| 287 | } |
|
| 288 | ||
| 289 | ||
| 290 | /******************************************************************************************************************* |
|