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
29 lines
649 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes as SoftDeletesOriginal;
|
|
|
|
trait SoftDeletes
|
|
{
|
|
use SoftDeletesOriginal;
|
|
|
|
protected function performDeleteOnModel()
|
|
{
|
|
if ($this->forceDeleting) {
|
|
$this->exists = false;
|
|
|
|
return $this->setKeysForSaveQuery($this->newModelQuery())->forceDelete();
|
|
}
|
|
|
|
$time = $this->freshTimestamp();
|
|
|
|
$this->{$this->getDeletedAtColumn()} = $time;
|
|
|
|
if ($this->timestamps && !is_null($this->getUpdatedAtColumn())) {
|
|
$this->{$this->getUpdatedAtColumn()} = $time;
|
|
}
|
|
|
|
return $this->save();
|
|
}
|
|
}
|