You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
649 B

  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\SoftDeletes as SoftDeletesOriginal;
  4. trait SoftDeletes
  5. {
  6. use SoftDeletesOriginal;
  7. protected function performDeleteOnModel()
  8. {
  9. if ($this->forceDeleting) {
  10. $this->exists = false;
  11. return $this->setKeysForSaveQuery($this->newModelQuery())->forceDelete();
  12. }
  13. $time = $this->freshTimestamp();
  14. $this->{$this->getDeletedAtColumn()} = $time;
  15. if ($this->timestamps && !is_null($this->getUpdatedAtColumn())) {
  16. $this->{$this->getUpdatedAtColumn()} = $time;
  17. }
  18. return $this->save();
  19. }
  20. }