@@ 277-298 (lines=22) @@ | ||
274 | * |
|
275 | * @return mixed |
|
276 | */ |
|
277 | public function restore($id) |
|
278 | { |
|
279 | $this->applyScope(); |
|
280 | ||
281 | $temporarySkipPresenter = $this->skipPresenter; |
|
282 | $this->skipPresenter(true); |
|
283 | ||
284 | $model = $this->withTrashed()->find($id); |
|
285 | ||
286 | $this->skipPresenter($temporarySkipPresenter); |
|
287 | $this->resetModel(); |
|
288 | ||
289 | $restored = $model->restore(); |
|
290 | ||
291 | event(new RepositoryEntityUpdated($this, $model)); |
|
292 | ||
293 | if ($restored) { |
|
294 | $restored = $model; |
|
295 | } |
|
296 | ||
297 | return $this->parserResult($restored); |
|
298 | } |
|
299 | ||
300 | /** |
|
301 | * restore multiple entities by given criteria. |
|
@@ 337-355 (lines=19) @@ | ||
334 | * |
|
335 | * @return int |
|
336 | */ |
|
337 | public function ForceDelete($id) |
|
338 | { |
|
339 | $this->applyScope(); |
|
340 | ||
341 | $temporarySkipPresenter = $this->skipPresenter; |
|
342 | $this->skipPresenter(true); |
|
343 | ||
344 | $model = $this->find($id); |
|
345 | $originalModel = clone $model; |
|
346 | ||
347 | $this->skipPresenter($temporarySkipPresenter); |
|
348 | $this->resetModel(); |
|
349 | ||
350 | $deleted = $model->ForceDelete(); |
|
351 | ||
352 | event(new RepositoryEntityDeleted($this, $originalModel)); |
|
353 | ||
354 | return $deleted; |
|
355 | } |
|
356 | ||
357 | /** |
|
358 | * ForceDelete multiple entities by given criteria. |