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