Fixes bug preventing proper updating of caches and models due to undefined Auth::user()

This commit is contained in:
Dane Everitt 2017-03-04 19:04:11 -05:00
parent e688468920
commit 5d59d364f8
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 5 additions and 2 deletions

View file

@ -142,8 +142,10 @@ class ServerObserver
public function updated(Server $server)
{
// Clear Caches
Cache::forget('Server.byUuid.' . $server->uuid . Auth::user()->uuid);
Cache::forget('Server.byUuid.' . $server->uuidShort . Auth::user()->uuid);
if (Auth::user()) {
Cache::forget('Server.byUuid.' . $server->uuid . Auth::user()->uuid);
Cache::forget('Server.byUuid.' . $server->uuidShort . Auth::user()->uuid);
}
event(new Events\Server\Updated($server));
}