[ENTITY][Note] Add deleter
This commit is contained in:
parent
b1585f0ef2
commit
5f167517ad
@ -360,6 +360,23 @@ class Note extends Entity
|
|||||||
return $mentioned;
|
return $mentioned;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete(?int $actor_id = null, string $source = 'web'): bool
|
||||||
|
{
|
||||||
|
if (Event::handle('NoteDeleteRelated', [&$this]) === Event::next) {
|
||||||
|
DB::persist(Activity::create([
|
||||||
|
'actor_id' => $actor_id ?? $this->getActorId(),
|
||||||
|
'verb' => 'delete',
|
||||||
|
'object_type' => 'note',
|
||||||
|
'object_id' => $this->getId(),
|
||||||
|
'source' => $source
|
||||||
|
])
|
||||||
|
);
|
||||||
|
DB::remove($this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static function schemaDef(): array
|
public static function schemaDef(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user