BookStack/app/Users/Controllers/UserProfileController.php

43 lines
1.2 KiB
PHP
Raw Normal View History

2021-06-26 23:23:15 +08:00
<?php
2023-05-18 00:56:55 +08:00
namespace BookStack\Users\Controllers;
2023-05-18 00:56:55 +08:00
use BookStack\Activity\ActivityQueries;
use BookStack\Http\Controller;
2023-05-18 00:56:55 +08:00
use BookStack\Users\Queries\UserContentCounts;
use BookStack\Users\Queries\UserRecentlyCreatedContent;
use BookStack\Users\UserRepo;
class UserProfileController extends Controller
{
public function __construct(
protected UserRepo $userRepo,
protected ActivityQueries $activityQueries,
protected UserContentCounts $contentCounts,
protected UserRecentlyCreatedContent $recentlyCreatedContent
) {
}
/**
2021-06-26 23:23:15 +08:00
* Show the user profile page.
*/
public function show(string $slug)
{
$user = $this->userRepo->getBySlug($slug);
$userActivity = $this->activityQueries->userActivity($user);
$recentlyCreated = $this->recentlyCreatedContent->run($user, 5);
$assetCounts = $this->contentCounts->run($user);
$this->setPageTitle($user->name);
return view('users.profile', [
2021-06-26 23:23:15 +08:00
'user' => $user,
'activity' => $userActivity,
'recentlyCreated' => $recentlyCreated,
2021-06-26 23:23:15 +08:00
'assetCounts' => $assetCounts,
]);
}
}