BookStack/app/Users/Controllers/UserProfileController.php

34 lines
971 B
PHP
Raw Normal View History

2021-06-26 11:23:15 -04:00
<?php
2023-05-17 12:56:55 -04:00
namespace BookStack\Users\Controllers;
2023-05-17 12:56:55 -04:00
use BookStack\Activity\ActivityQueries;
use BookStack\Http\Controller;
2023-05-17 12:56:55 -04:00
use BookStack\Users\Queries\UserContentCounts;
use BookStack\Users\Queries\UserRecentlyCreatedContent;
use BookStack\Users\UserRepo;
class UserProfileController extends Controller
{
/**
2021-06-26 11:23:15 -04:00
* Show the user profile page.
*/
public function show(UserRepo $repo, ActivityQueries $activities, string $slug)
{
$user = $repo->getBySlug($slug);
$userActivity = $activities->userActivity($user);
2022-02-13 07:56:26 -05:00
$recentlyCreated = (new UserRecentlyCreatedContent())->run($user, 5);
$assetCounts = (new UserContentCounts())->run($user);
$this->setPageTitle($user->name);
return view('users.profile', [
2021-06-26 11:23:15 -04:00
'user' => $user,
'activity' => $userActivity,
'recentlyCreated' => $recentlyCreated,
2021-06-26 11:23:15 -04:00
'assetCounts' => $assetCounts,
]);
}
}