DashboardService
final class DashboardService
Supports admin dashboard operations.
Constants
| STATUS_OPTIONS |
Status filter options: value as stored in users.inactive => label. Same value => label shape as ACL::getOptionsForForm(). |
Methods
Warns if admin user is attempting to view an area they should not be.
Builds the search/filter definition for the admin user list. Always excludes the current user.
Returns list of paginated users matching the filter.
Builds the paginated, filtered user list as plain arrays. Shared by the initial React render and the JSON responses for page/sort/filter changes.
Serializes a user for the dashboard. Only the fields the table needs; never pass whole models to the client (password hashes, tokens, etc.).
Converts value => label options to a list for React. A list keeps order and avoids PHP turning '0'/'1' keys into a JSON array.
Details
at line 24
static void
checkIfCurrentUser(User $user, string $redirect = '')
Warns if admin user is attempting to view an area they should not be.
at line 47
static SearchFilter
userFilter(object $request)
Builds the search/filter definition for the admin user list. Always excludes the current user.
at line 65
static array
paginateUsers(Pagination $pagination, SearchFilter $filter)
Returns list of paginated users matching the filter.
at line 75
static int
totalUsers(SearchFilter $filter)
Returns the number of users matching the filter.
at line 87
static array
userList(object $request, int $perPage = 10)
Builds the paginated, filtered user list as plain arrays. Shared by the initial React render and the JSON responses for page/sort/filter changes.
at line 106
static array
userToArray(User $user)
Serializes a user for the dashboard. Only the fields the table needs; never pass whole models to the client (password hashes, tokens, etc.).
at line 126
static array
optionList(array $options)
Converts value => label options to a list for React. A list keeps order and avoids PHP turning '0'/'1' keys into a JSON array.