BookStack/app/Http/Controllers/UserProfileController.php

33 lines
935 B
PHP
Raw Normal View History

2021-06-26 23:23:15 +08:00
<?php
namespace BookStack\Http\Controllers;
use BookStack\Actions\ActivityQueries;
2022-02-13 20:56:26 +08:00
use BookStack\Auth\Queries\UserContentCounts;
use BookStack\Auth\Queries\UserRecentlyCreatedContent;
use BookStack\Auth\UserRepo;
class UserProfileController extends Controller
{
/**
2021-06-26 23:23:15 +08: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 20:56:26 +08:00
$recentlyCreated = (new UserRecentlyCreatedContent())->run($user, 5);
$assetCounts = (new UserContentCounts())->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,
]);
}
}