mirror of
https://github.com/grokability/snipe-it.git
synced 2026-03-12 17:52:00 +08:00
Added getters
This commit is contained in:
@@ -208,6 +208,68 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
* @return Attribute
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* These fields should be hidden if the requesting user cannot view contact info
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function address(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
protected function city(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
protected function state(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
protected function country(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
protected function zip(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
protected function phone(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
protected function mobile(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
protected function website(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => (auth()->user() && auth()->user()->can('manageContactInfo')) ? $value : null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected function displayName(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
|
||||
Reference in New Issue
Block a user