optimizations
This commit is contained in:
69
app/Models/UserActivity.php
Normal file
69
app/Models/UserActivity.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class UserActivity extends Model
|
||||
{
|
||||
protected $table = 'user_activities';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public const CREATED_AT = 'created_at';
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
public const TYPE_UPLOAD = 'upload';
|
||||
public const TYPE_COMMENT = 'comment';
|
||||
public const TYPE_REPLY = 'reply';
|
||||
public const TYPE_LIKE = 'like';
|
||||
public const TYPE_FAVOURITE = 'favourite';
|
||||
public const TYPE_FOLLOW = 'follow';
|
||||
public const TYPE_ACHIEVEMENT = 'achievement';
|
||||
public const TYPE_FORUM_POST = 'forum_post';
|
||||
public const TYPE_FORUM_REPLY = 'forum_reply';
|
||||
|
||||
public const ENTITY_ARTWORK = 'artwork';
|
||||
public const ENTITY_ARTWORK_COMMENT = 'artwork_comment';
|
||||
public const ENTITY_USER = 'user';
|
||||
public const ENTITY_ACHIEVEMENT = 'achievement';
|
||||
public const ENTITY_FORUM_THREAD = 'forum_thread';
|
||||
public const ENTITY_FORUM_POST = 'forum_post';
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'type',
|
||||
'entity_type',
|
||||
'entity_id',
|
||||
'meta',
|
||||
'created_at',
|
||||
'hidden_at',
|
||||
'hidden_by',
|
||||
'hidden_reason',
|
||||
'flagged_at',
|
||||
'flagged_by',
|
||||
'flag_reason',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => 'integer',
|
||||
'entity_id' => 'integer',
|
||||
'meta' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'hidden_at' => 'datetime',
|
||||
'hidden_by' => 'integer',
|
||||
'flagged_at' => 'datetime',
|
||||
'flagged_by' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user