mirror of
https://github.com/flarum/core.git
synced 2025-08-13 20:04:24 +02:00
Database changes (#34)
* Implement database changes * Split foreign keys in to their own migrations; rename pivot tables * Use whereColumn * Update core attribute names
This commit is contained in:
committed by
Franz Liedke
parent
f8ad54cb1f
commit
67c7b45dc8
@@ -30,8 +30,8 @@ class AddFilterByMentions
|
||||
public function addFilter(ConfigurePostsQuery $event)
|
||||
{
|
||||
if ($mentionedId = array_get($event->filter, 'mentioned')) {
|
||||
$event->query->join('mentions_users', 'posts.id', '=', 'mentions_users.post_id')
|
||||
->where('mentions_users.mentions_id', '=', $mentionedId);
|
||||
$event->query->join('post_mentions_user', 'posts.id', '=', 'post_mentions_user.post_id')
|
||||
->where('post_mentions_user.mentions_user_id', '=', $mentionedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -57,15 +57,15 @@ class AddPostMentionedByRelationship
|
||||
public function getModelRelationship(GetModelRelationship $event)
|
||||
{
|
||||
if ($event->isRelationship(Post::class, 'mentionedBy')) {
|
||||
return $event->model->belongsToMany(Post::class, 'mentions_posts', 'mentions_id', 'post_id', null, null, 'mentionedBy');
|
||||
return $event->model->belongsToMany(Post::class, 'post_mentions_post', 'mentions_post_id', 'post_id', null, null, 'mentionedBy');
|
||||
}
|
||||
|
||||
if ($event->isRelationship(Post::class, 'mentionsPosts')) {
|
||||
return $event->model->belongsToMany(Post::class, 'mentions_posts', 'post_id', 'mentions_id', null, null, 'mentionsPosts');
|
||||
return $event->model->belongsToMany(Post::class, 'post_mentions_post', 'post_id', 'mentions_post_id', null, null, 'mentionsPosts');
|
||||
}
|
||||
|
||||
if ($event->isRelationship(Post::class, 'mentionsUsers')) {
|
||||
return $event->model->belongsToMany(User::class, 'mentions_users', 'post_id', 'mentions_id', null, null, 'mentionsUsers');
|
||||
return $event->model->belongsToMany(User::class, 'post_mentions_user', 'post_id', 'mentions_user_id', null, null, 'mentionsUsers');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -48,7 +48,7 @@ class PostMentionedBlueprint implements BlueprintInterface, MailableInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSender()
|
||||
public function getFromUser()
|
||||
{
|
||||
return $this->reply->user;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class UserMentionedBlueprint implements BlueprintInterface, MailableInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSender()
|
||||
public function getFromUser()
|
||||
{
|
||||
return $this->post->user;
|
||||
}
|
||||
|
Reference in New Issue
Block a user