Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/SharedFolderObserver.php
Show All 14 Lines | class SharedFolderObserver | ||||
*/ | */ | ||||
public function creating(SharedFolder $folder): void | public function creating(SharedFolder $folder): void | ||||
{ | { | ||||
if (empty($folder->type)) { | if (empty($folder->type)) { | ||||
$folder->type = 'mail'; | $folder->type = 'mail'; | ||||
} | } | ||||
if (empty($folder->email)) { | if (empty($folder->email)) { | ||||
if (!isset($folder->name)) { | if (!isset($folder->domain)) { | ||||
throw new \Exception("Missing 'domain' property for a new shared folder"); | throw new \Exception("Missing 'domain' property for a new shared folder"); | ||||
} | } | ||||
$domainName = \strtolower($folder->domain); | $domainName = \strtolower($folder->domain); | ||||
$folder->email = "{$folder->type}-{$folder->id}@{$domainName}"; | $folder->email = "{$folder->type}-{$folder->id}@{$domainName}"; | ||||
} else { | } else { | ||||
$folder->email = \strtolower($folder->email); | $folder->email = \strtolower($folder->email); | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |