Changeset View
Changeset View
Standalone View
Standalone View
src/app/User.php
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | public function canUpdate($object): bool | ||||
if ($object instanceof User && $this->id == $object->id) { | if ($object instanceof User && $this->id == $object->id) { | ||||
return true; | return true; | ||||
} | } | ||||
return $this->canDelete($object); | return $this->canDelete($object); | ||||
} | } | ||||
/** | /** | ||||
* Return the \App\Domain for this user. | |||||
* | |||||
* @return \App\Domain|null | |||||
*/ | |||||
public function domain() | |||||
{ | |||||
list($local, $domainName) = explode('@', $this->email); | |||||
$domain = \App\Domain::withTrashed()->where('namespace', $domainName)->first(); | |||||
return $domain; | |||||
} | |||||
/** | |||||
* List the domains to which this user is entitled. | * List the domains to which this user is entitled. | ||||
* | * | ||||
* @return Domain[] | * @return Domain[] | ||||
*/ | */ | ||||
public function domains() | public function domains() | ||||
{ | { | ||||
$dbdomains = Domain::whereRaw( | $dbdomains = Domain::whereRaw( | ||||
sprintf( | sprintf( | ||||
▲ Show 20 Lines • Show All 441 Lines • Show Last 20 Lines |