1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

Use new Model extender

This commit is contained in:
Franz Liedke
2020-04-24 15:55:50 +02:00
parent 9587d3b416
commit a552b957ba
2 changed files with 7 additions and 23 deletions

View File

@@ -22,6 +22,8 @@ use Flarum\Post\Event\Hidden;
use Flarum\Post\Event\Posted;
use Flarum\Post\Event\Restored;
use Flarum\Post\Event\Revised;
use Flarum\Post\Post;
use Flarum\User\User;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\View\Factory;
@@ -33,6 +35,11 @@ return [
(new Extend\Formatter)
->configure(ConfigureMentions::class),
(new Extend\Model(Post::class))
->belongsToMany('mentionedBy', Post::class, 'post_mentions_post', 'mentions_post_id', 'post_id')
->belongsToMany('mentionsPosts', Post::class, 'post_mentions_post', 'post_id', 'mentions_post_id')
->belongsToMany('mentionsUsers', User::class, 'post_mentions_user', 'post_id', 'mentions_user_id'),
function (Dispatcher $events, Factory $views) {
$events->listen(WillSerializeData::class, Listener\FilterVisiblePosts::class);
$events->subscribe(Listener\AddPostMentionedByRelationship::class);