Added deletion of favourites on entity/user delete

This commit is contained in:
Dan Brown
2021-05-23 13:41:56 +01:00
parent 1e0aa7ee2c
commit c2069f37cc
3 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<?php namespace BookStack\Auth;
use BookStack\Actions\Favourite;
use BookStack\Api\ApiToken;
use BookStack\Entities\Tools\SlugGenerator;
use BookStack\Interfaces\Loggable;
@ -240,6 +241,14 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
return $this->hasMany(ApiToken::class);
}
/**
* Get the favourite instances for this user.
*/
public function favourites(): HasMany
{
return $this->hasMany(Favourite::class);
}
/**
* Get the last activity time for this user.
*/