added php sandbox and some helper funcs to models
This commit is contained in:
@@ -109,4 +109,26 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasMany(Notification::class, 'actor_id');
|
||||
}
|
||||
|
||||
// --------- Relation Helpers ---------
|
||||
|
||||
public function addFavourite(Table $table)
|
||||
{
|
||||
$this->favouriteTables()->attach($table);
|
||||
}
|
||||
|
||||
public function removeFavourite(Table $table)
|
||||
{
|
||||
$this->favouriteTables()->detach($table);
|
||||
}
|
||||
|
||||
public function followDiscussion(Table $table)
|
||||
{
|
||||
$this->followedDiscussions()->attach($table);
|
||||
}
|
||||
|
||||
public function unfollowDiscussion(Table $table)
|
||||
{
|
||||
$this->followedDiscussions()->detach($table);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user