mirror of
https://github.com/pelican-dev/panel.git
synced 2025-10-29 23:26:52 +01:00
Leverage user() helper (#1832)
This commit is contained in:
parent
e6bd6e416f
commit
3bcdeea800
@ -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)
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user