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

@ -11,6 +11,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
### Fixed
* Fixes potential bug with invalid CIDR notation (ex: `192.168.1.1/z`) when adding allocations that could cause over 4 million records to be created at once.
* `[pre.4]` — Fixes bug preventing server updates from occurring by the system due to undefined `Auth::user()` in the event listener.
### Added
* Ability to assign multiple allocations at once when creating a new server.

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));
}