diff --git a/app/Mention.php b/app/Mention.php new file mode 100644 index 000000000..9600c32b0 --- /dev/null +++ b/app/Mention.php @@ -0,0 +1,33 @@ +belongsTo(Profile::class, 'profile_id', 'id'); + } + + public function status() + { + return $this->belongsTo(Status::class); + } + + public function toText() + { + $actorName = $this->status->profile->username; + return "{$actorName} " . __('notification.mentionedYou'); + } + + public function toHtml() + { + $actorName = $this->status->profile->username; + $actorUrl = $this->status->profile->url(); + return "{$actorName} " . + __('notification.mentionedYou'); + } +} diff --git a/database/migrations/2018_06_08_003624_create_mentions_table.php b/database/migrations/2018_06_08_003624_create_mentions_table.php new file mode 100644 index 000000000..2f43d1bae --- /dev/null +++ b/database/migrations/2018_06_08_003624_create_mentions_table.php @@ -0,0 +1,34 @@ +bigIncrements('id'); + $table->bigInteger('status_id')->unsigned(); + $table->bigInteger('profile_id')->unsigned(); + $table->boolean('local')->default(true); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('mentions'); + } +} diff --git a/resources/lang/en/notification.php b/resources/lang/en/notification.php index 2f85c4386..71d87a131 100644 --- a/resources/lang/en/notification.php +++ b/resources/lang/en/notification.php @@ -5,5 +5,6 @@ return [ 'likedPhoto' => 'liked your photo.', 'startedFollowingYou' => 'started following you.', 'commented' => 'commented on your post.', + 'mentionedYou' => 'mentioned you.' ]; \ No newline at end of file