/**
* @param GetModelRelationship $event
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|null
*/
public function getModelRelationship(GetModelRelationship $event)
{
if ($event->isRelationship(Post::class, 'mentionedBy')) {
return $event->model->belongsToMany(Post::class, 'mentions_posts', 'mentions_id', 'post_id', 'mentionedBy');
}
if ($event->isRelationship(Post::class, 'mentionsPosts')) {
return $event->model->belongsToMany(Post::class, 'mentions_posts', 'post_id', 'mentions_id', 'mentionsPosts');
}
if ($event->isRelationship(Post::class, 'mentionsUsers')) {
return $event->model->belongsToMany(User::class, 'mentions_users', 'post_id', 'mentions_id', 'mentionsUsers');
}
}