mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Optimize queries for statistics.
This commit is contained in:
@@ -40,7 +40,7 @@ trait ChecksLogin
|
||||
{
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
// Only allow logged-in users
|
||||
$check = auth()->check();
|
||||
$check = auth()->check();
|
||||
if (!$check) {
|
||||
return false;
|
||||
}
|
||||
@@ -79,19 +79,19 @@ trait ChecksLogin
|
||||
public function getUserGroup(): ?UserGroup
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
app('log')->debug('Now in getUserGroup()');
|
||||
|
||||
/** @var null|UserGroup $userGroup */
|
||||
$userGroup = $this->route()?->parameter('userGroup');
|
||||
if (null === $userGroup) {
|
||||
app('log')->debug('Request class has no userGroup parameter, but perhaps there is a parameter.');
|
||||
$userGroupId = (int) $this->get('user_group_id');
|
||||
$userGroupId = (int)$this->get('user_group_id');
|
||||
if (0 === $userGroupId) {
|
||||
app('log')->debug(sprintf('Request class has no user_group_id parameter, grab default from user (group #%d).', $user->user_group_id));
|
||||
$userGroupId = (int) $user->user_group_id;
|
||||
$userGroupId = (int)$user->user_group_id;
|
||||
}
|
||||
$userGroup = UserGroup::find($userGroupId);
|
||||
$userGroup = UserGroup::find($userGroupId);
|
||||
if (null === $userGroup) {
|
||||
app('log')->error(sprintf('Request class has user_group_id (#%d), but group does not exist.', $userGroupId));
|
||||
|
||||
|
Reference in New Issue
Block a user