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