feat: add community activity feed and mentions
This commit is contained in:
51
app/Models/UserMention.php
Normal file
51
app/Models/UserMention.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class UserMention extends Model
|
||||
{
|
||||
protected $table = 'user_mentions';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'mentioned_user_id',
|
||||
'artwork_id',
|
||||
'comment_id',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'integer',
|
||||
'mentioned_user_id' => 'integer',
|
||||
'artwork_id' => 'integer',
|
||||
'comment_id' => 'integer',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function actor(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function mentionedUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'mentioned_user_id');
|
||||
}
|
||||
|
||||
public function artwork(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Artwork::class);
|
||||
}
|
||||
|
||||
public function comment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ArtworkComment::class, 'comment_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user