Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F25451874
AccountHelpers.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
AccountHelpers.php
View Options
<?php
namespace
AuthGrove\Console\Services
;
use
AuthGrove\User
;
class
AccountHelpers
{
/**
* Finds an user from user id, name or e-mail
*
* @param mixed $data User id, name or e-mail
* @return User|null
*/
public
static
function
findUser
(
$data
)
{
//By id
if
(
is_numeric
(
$data
))
{
return
User
::
find
(
$data
);
}
//By other attributes
$attributes
=
[
'username'
,
'email'
];
foreach
(
$attributes
as
$attribute
)
{
$user
=
User
::
findBy
(
$attribute
,
$data
);
if
(
$user
!==
null
)
{
return
$user
;
}
}
return
null
;
}
public
static
function
getNonBreakableSpace
()
{
return
mb_convert_encoding
(
' '
,
'UTF-8'
,
'HTML-ENTITIES'
);
}
public
static
function
localizeUserAttribute
(
$attribute
,
$useNoBreakableSpace
=
true
)
{
$localizedKey
=
'panel.user-attributes.'
.
$attribute
;
$localizedString
=
trans
(
$localizedKey
);
if
(
$useNoBreakableSpace
)
{
return
str_replace
(
' '
,
self
::
getNonBreakableSpace
(),
$localizedString
);
}
return
$localizedString
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Apr 16, 05:41 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3625993
Default Alt Text
AccountHelpers.php (1 KB)
Attached To
Mode
rGROVE Auth Grove
Attached
Detach File
Event Timeline
Log In to Comment