/** * @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'); } }
/** * @param GetModelRelationship $event * @return \Illuminate\Database\Eloquent\Relations\HasMany|null */ public function getModelRelationship(GetModelRelationship $event) { if ($event->isRelationship(Post::class, 'flags')) { return $event->model->hasMany(Flag::class, 'post_id'); } }
/** * @param GetModelRelationship $event * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|null */ public function getModelRelationship(GetModelRelationship $event) { if ($event->isRelationship(Post::class, 'likes')) { return $event->model->belongsToMany(User::class, 'posts_likes', 'post_id', 'user_id', 'likes'); } }
/** * @param GetModelRelationship $event * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|null */ public function getModelRelationship(GetModelRelationship $event) { if ($event->isRelationship(Discussion::class, 'tags')) { return $event->model->belongsToMany(Tag::class, 'discussions_tags', null, null, 'tags'); } }
/** * @param GetModelRelationship $event * * @return \Illuminate\Database\Eloquent\Relations\HasMany|null */ public function getModelRelationship(GetModelRelationship $event) { if ($event->isRelationship(Post::class, 'moderatornotes')) { return $event->model->hasMany(ModeratorNotes::class, 'post_id'); } }