messages implemented

This commit is contained in:
2026-02-26 21:12:32 +01:00
parent d0aefc5ddc
commit 15b7b77d20
168 changed files with 14728 additions and 6786 deletions

View File

@@ -1,10 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* User Statistics v2 schema.
*
* Single row per user (user_id is PK).
* All counters are unsignedBigInteger with default 0.
*
* All updates MUST go through App\Services\UserStatsService.
*/
class UserStatistic extends Model
{
protected $table = 'user_statistics';
@@ -14,11 +24,44 @@ class UserStatistic extends Model
protected $fillable = [
'user_id',
'uploads',
'downloads',
'pageviews',
'awards',
'profile_views',
// Creator upload activity
'uploads_count',
// Creator-received metrics
'downloads_received_count',
'artwork_views_received_count',
'awards_received_count',
'favorites_received_count',
'comments_received_count',
'reactions_received_count',
// Social stats (managed by FollowService)
'followers_count',
'following_count',
// Profile / discovery
'profile_views_count',
// Activity timestamps
'last_upload_at',
'last_active_at',
];
protected $casts = [
'user_id' => 'integer',
'uploads_count' => 'integer',
'downloads_received_count' => 'integer',
'artwork_views_received_count' => 'integer',
'awards_received_count' => 'integer',
'favorites_received_count' => 'integer',
'comments_received_count' => 'integer',
'reactions_received_count' => 'integer',
'followers_count' => 'integer',
'following_count' => 'integer',
'profile_views_count' => 'integer',
'last_upload_at' => 'datetime',
'last_active_at' => 'datetime',
];
public $timestamps = true;