value('disable', 1) ->where(static::primary_key(), '=', $this->{static::primary_key()}) : null; $this->pre_delete($query); $result = $query ? $query->execute(static::get_connection(true)) : null; return $this->post_delete($result); } protected function pre_save(&$query) { if($this->is_new()) { if(!isset($this->{static::primary_key()}) || !$this->{static::primary_key()} || $this->{static::primary_key()} === null) { $this->{static::primary_key()} = Str::random('uuid'); $query->set([static::primary_key() => $this->{static::primary_key()}]); } } } }