Leverage user() helper (#1832)

This commit is contained in:
MartinOscar 2025-10-26 16:24:34 +01:00 committed by GitHub
parent e6bd6e416f
commit 3bcdeea800
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -414,7 +414,7 @@ class UserResource extends Resource
$sshKey->delete(); $sshKey->delete();
Activity::event('user:ssh-key.delete') Activity::event('user:ssh-key.delete')
->actor(auth()->user()) ->actor(user())
->subject($user) ->subject($user)
->subject($sshKey) ->subject($sshKey)
->property('fingerprint', $sshKey->fingerprint) ->property('fingerprint', $sshKey->fingerprint)

View File

@ -51,7 +51,7 @@ class Startup extends ServerFormPage
->label(trans('server/startup.command')) ->label(trans('server/startup.command'))
->live() ->live()
->visible(fn (Server $server) => in_array($server->startup, $server->egg->startup_commands)) ->visible(fn (Server $server) => in_array($server->startup, $server->egg->startup_commands))
->disabled(fn (Server $server) => !auth()->user()->can(Permission::ACTION_STARTUP_UPDATE, $server)) ->disabled(fn (Server $server) => !user()?->can(Permission::ACTION_STARTUP_UPDATE, $server))
->formatStateUsing(fn (Server $server) => $server->startup) ->formatStateUsing(fn (Server $server) => $server->startup)
->afterStateUpdated(function ($state, Server $server, Set $set) { ->afterStateUpdated(function ($state, Server $server, Set $set) {
$original = $server->startup; $original = $server->startup;

View File

@ -165,7 +165,7 @@ class ActivityLog extends Model implements HasIcon, HasLabel
public function getIp(): ?string public function getIp(): ?string
{ {
return auth()->user()->can('seeIps activityLog') ? $this->ip : null; return user()?->can('seeIps activityLog') ? $this->ip : null;
} }
public function htmlable(): string public function htmlable(): string