User Profiles
Relevant source files
The following files were used as context for generating this wiki page:
- app/Livewire/Profile/ProfilePage.php
- resources/views/livewire/profile/profile-page.blade.php
- resources/views/livewire/profile/edit-profile-form.blade.php
- tests/Feature/UserSchemaTest.php
- tests/Feature/Livewire/ProfilePageTest.php
- tests/Feature/Domain/UserPublicProfilePresenterTest.php
- tests/Feature/Livewire/EditProfileFormTest.php
- tests/Feature/Filament/UserResourceTest.php
User Profiles in RateGuru serve as the central hub for user identity, social interaction, and content aggregation. The system provides a public-facing profile view that showcases user statistics, published posts, and rating activity, alongside a private management interface for updating personal information and privacy settings.
The profile architecture is built on the Laravel Livewire stack, utilizing a component-driven approach to handle real-time updates for social actions like following and tab switching without full page reloads.
Data Model and Schema
The user profile is backed by the users table, which includes fields for identity, social presence, and system roles.
User Table Fields
| Field | Type | Description |
|---|---|---|
username | String | Unique, canonical lowercase identifier used in profile URLs. |
name | String | The user's full name. |
display_name | String | Preferred public name; falls back to name or username. |
email | String | Unique email address for authentication. |
bio | Text | Short biography (max 500 characters). |
profile_website_url | String | Optional external link displayed on the profile. |
avatar_url | String | URL to an externally hosted profile image. |
avatar_path | String | Path to a locally stored profile image in the public disk. |
role | Enum | System role: User, Moderator, or Admin. |
status | Enum | User account status: Active, Limited, or Banned. |
trust_level | Integer | Numeric value used for moderation and permission logic. |
rating_activity_visibility | Enum | Privacy setting: public or private. |
Sources: tests/Feature/UserSchemaTest.php:1-135, resources/views/livewire/profile/edit-profile-form.blade.php:38-75, app/Livewire/Profile/ProfilePage.php:87-91
Profile Architecture and Flow
The profile system utilizes a primary Livewire component, ProfilePage, which manages the state for viewing a user's public presence.
Profile Viewing Logic
When a user visits /u/{username}, the ProfilePage component:
- Resolves the user by their unique username.
- Loads counts for followers and following relationships.
- Calculates profile statistics using
ProfileStats. - Manages a tabbed interface for "Posts", "Activity", and "Saved" content.
Navigation and Component Interaction
The profile interface reacts to events and handles authorization-gated actions such as following and reporting.
Profile Features
Tabbed Content Management
The profile provides three primary tabs, with visibility controlled by ownership and privacy settings:
- Posts: Displays a grid of the user's published posts using
UserPublicPostsQuery. Non-published posts (pending, rejected, hidden) are excluded. - Activity: Shows the user's voting history. This tab is visible to the public only if
rating_activity_visibilityis set topublic. - Saved: Only visible to the profile owner, showing their bookmarked posts.
Sources: app/Livewire/Profile/ProfilePage.php:48-85, tests/Feature/Livewire/ProfilePageTest.php:143-165
Profile Editing
Users can update their profile information via the EditProfileForm. This form handles:
- Identity: Updating
display_name(max 80 chars) andbio. - Social: Updating the website URL and uploading a new avatar.
- Privacy: Toggling
rating_activity_visibilitybetweenpublicandprivate.
Sources: resources/views/livewire/profile/edit-profile-form.blade.php:1-85, tests/Feature/Livewire/EditProfileFormTest.php:10-53
Administrative Management
Admins and Moderators can manage users through the Filament-based UserResource.
| Action | Role Requirement | Description |
|---|---|---|
| Access Index | Admin / Moderator | View a searchable, sortable list of all users. |
| Edit Identity | Admin Only | Change username, name, email, and password. |
| Manage Status | Admin Only | Update status (e.g., Active to Banned) and Role. |
| Adjust Trust | Admin Only | Set the numeric trust level (must be an integer). |
Sources: tests/Feature/Filament/UserResourceTest.php:15-100
Conclusion
The User Profile system in RateGuru integrates identity management with social discovery. It balances public transparency through statistics and activity feeds with user-controlled privacy settings, all while providing robust administrative oversight via the Filament management layer.