Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/RelationController.php
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | protected static function objectState($resource): array | ||||
foreach (array_keys($reflect->getConstants()) as $const) { | foreach (array_keys($reflect->getConstants()) as $const) { | ||||
if (strpos($const, 'STATUS_') === 0 && $const != 'STATUS_NEW') { | if (strpos($const, 'STATUS_') === 0 && $const != 'STATUS_NEW') { | ||||
$method = Str::camel('is_' . strtolower(substr($const, 7))); | $method = Str::camel('is_' . strtolower(substr($const, 7))); | ||||
$state[$method] = $resource->{$method}(); | $state[$method] = $resource->{$method}(); | ||||
} | } | ||||
} | } | ||||
$with_imap = \config('app.with_imap'); | |||||
$with_ldap = \config('app.with_ldap'); | |||||
$state['isReady'] = (!$with_imap || !isset($state['isImapReady']) || $state['isImapReady']) | |||||
&& (!$with_ldap || !isset($state['isLdapReady']) || $state['isLdapReady']) | |||||
&& (!isset($state['isVerified']) || $state['isVerified']) | |||||
&& (!isset($state['isConfirmed']) || $state['isConfirmed']); | |||||
if (!$with_imap) { | |||||
unset($state['isImapReady']); | |||||
} | |||||
if (!$with_ldap) { | |||||
unset($state['isLdapReady']); | |||||
} | |||||
if (empty($state['isDeleted']) && method_exists($resource, 'trashed')) { | if (empty($state['isDeleted']) && method_exists($resource, 'trashed')) { | ||||
$state['isDeleted'] = $resource->trashed(); | $state['isDeleted'] = $resource->trashed(); | ||||
} | } | ||||
return $state; | return $state; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines |