Definition at line 13 of file User.php.
App\Models\User::accessories |
( |
| ) |
|
Get accessories assigned to this user.
Definition at line 139 of file User.php.
141 return $this->belongsToMany(
'\App\Models\Accessory',
'accessories_users',
'assigned_to',
'accessory_id')->withPivot(
'id')->withTrashed();
App\Models\User::accountStatus |
( |
| ) |
|
App\Models\User::assetlog |
( |
| ) |
|
Definition at line 208 of file User.php.
210 return $this->hasMany(
'\App\Models\Asset',
'id')->withTrashed();
App\Models\User::assets |
( |
| ) |
|
Get assets assigned to this user.
Definition at line 131 of file User.php.
133 return $this->hasMany(
'\App\Models\Asset',
'assigned_to')->withTrashed();
App\Models\User::company |
( |
| ) |
|
Definition at line 78 of file User.php.
80 return $this->belongsTo(
'\App\Models\Company',
'company_id');
App\Models\User::consumables |
( |
| ) |
|
Get consumables assigned to this user.
Definition at line 147 of file User.php.
149 return $this->belongsToMany(
'\App\Models\Consumable',
'consumables_users',
'assigned_to',
'consumable_id')->withPivot(
'id')->withTrashed();
App\Models\User::fullName |
( |
| ) |
|
Returns the user full name, it simply concatenates the user first and last name.
- Returns
- string
Definition at line 99 of file User.php.
101 return "{$this->first_name} {$this->last_name}";
static App\Models\User::generateFormattedNameFromFullName |
( |
|
$format = 'filastname' , |
|
|
|
$users_name |
|
) |
| |
|
static |
Definition at line 266 of file User.php.
268 $name = explode(
" ", $users_name);
269 $name = str_replace(
"'",
'', $name);
270 $first_name = $name[0];
271 $email_last_name =
'';
272 $email_prefix = $first_name;
275 if (!array_key_exists(1, $name)) {
277 $email_last_name = $last_name;
278 $user_username = $first_name;
283 $last_name = str_replace($first_name,
'', $users_name);
285 if ($format==
'filastname') {
286 $email_last_name.=str_replace(
' ',
'', $last_name);
287 $email_prefix = $first_name[0].$email_last_name;
289 } elseif ($format==
'firstname.lastname') {
290 $email_last_name.=str_replace(
' ',
'', $last_name);
291 $email_prefix = $first_name.
'.'.$email_last_name;
293 } elseif ($format==
'firstname') {
294 $email_last_name.=str_replace(
' ',
'', $last_name);
295 $email_prefix = $first_name;
300 $user_username = $email_prefix;
301 $user[
'first_name'] = $first_name;
302 $user[
'last_name'] = $last_name;
303 $user[
'username'] = strtolower($user_username);
App\Models\User::getPersistCode |
( |
| ) |
|
Override the SentryUser getPersistCode method for multiple logins at one time.
Definition at line 244 of file User.php.
247 if (!config(
'session.multi_login') || (!$this->persist_code)) {
248 $this->persist_code = $this->getRandomString();
251 $persistCode = $this->persist_code;
255 return $this->persist_code;
App\Models\User::gravatar |
( |
| ) |
|
Returns the user Gravatar image url.
- Returns
- string
Definition at line 110 of file User.php.
114 return config(
'app.url').
'/uploads/avatars/'.$this->avatar;
119 $gravatar = md5(strtolower(trim($this->email)));
121 return "//gravatar.com/avatar/".$gravatar;
App\Models\User::groups |
( |
| ) |
|
Get user groups.
Definition at line 187 of file User.php.
189 return $this->belongsToMany(
'\App\Models\Group',
'users_groups');
App\Models\User::hasAccess |
( |
|
$section | ) |
|
Definition at line 43 of file User.php.
45 $user_permissions = json_decode($this->permissions,
true);
46 $user_groups = $this->
groups();
48 if (((array_key_exists($section, $user_permissions)) && ($user_permissions[$section]==
'1')) ||
49 ((array_key_exists(
'admin', $user_permissions)) && ($user_permissions[
'admin']==
'1'))) {
53 foreach ($user_groups as $user_group) {
54 $group_permissions = json_decode($user_group->permissions,
true);
55 if (((array_key_exists($section, $group_permissions)) && ($group_permissions[$section]==
'1')) ||
56 ((array_key_exists(
'admin', $group_permissions)) && ($group_permissions[
'admin']==
'1'))) {
App\Models\User::isActivated |
( |
| ) |
|
Definition at line 83 of file User.php.
85 if ($this->activated == 1) {
App\Models\User::isSuperUser |
( |
| ) |
|
Definition at line 64 of file User.php.
65 $user_permissions = json_decode($this->permissions,
true);
66 $user_groups = $this->
groups();
68 if ((array_key_exists(
'superuser', $user_permissions)) && ($user_permissions[
'superuser']==
'1')) {
App\Models\User::licenses |
( |
| ) |
|
Get licenses assigned to this user.
Definition at line 155 of file User.php.
157 return $this->belongsToMany(
'\App\Models\License',
'license_seats',
'assigned_to',
'license_id')->withPivot(
'id');
App\Models\User::manager |
( |
| ) |
|
Get the user's manager based on the assigned user.
Definition at line 179 of file User.php.
181 return $this->belongsTo(
'\App\Models\User',
'manager_id')->withTrashed();
App\Models\User::scopeDeleted |
( |
|
$query | ) |
|
Query builder scope for Deleted users.
- Parameters
-
Illuminate\Database\Query\Builder | $query | Query builder instance |
- Returns
- Illuminate Modified query builder
Definition at line 351 of file User.php.
353 return $query->whereNotNull(
'deleted_at');
App\Models\User::scopeGetDeleted |
( |
|
$query | ) |
|
Definition at line 230 of file User.php.
232 return $query->withTrashed()->whereNotNull(
'deleted_at');
App\Models\User::scopeGetNotDeleted |
( |
|
$query | ) |
|
Definition at line 235 of file User.php.
237 return $query->whereNull(
'deleted_at');
App\Models\User::scopeMatchEmailOrUsername |
( |
|
$query, |
|
|
|
$user_username, |
|
|
|
$user_email |
|
) |
| |
Definition at line 258 of file User.php.
260 return $query->where(
'email',
'=', $user_email)
261 ->orWhere(
'username',
'=', $user_username)
262 ->orWhere(
'username',
'=', $user_email);
App\Models\User::scopeOrderLocation |
( |
|
$query, |
|
|
|
$order |
|
) |
| |
Query builder scope to order on company.
- Parameters
-
Illuminate\Database\Query\Builder | $query | Query builder instance |
text | $order | Order |
- Returns
- Illuminate Modified query builder
Definition at line 379 of file User.php.
381 return $query->leftJoin(
'locations',
'users.location_id',
'=',
'locations.id')->orderBy(
'locations.name', $order);
App\Models\User::scopeOrderManager |
( |
|
$query, |
|
|
|
$order |
|
) |
| |
Query builder scope to order on manager.
- Parameters
-
Illuminate\Database\Query\Builder | $query | Query builder instance |
text | $order | Order |
- Returns
- Illuminate Modified query builder
Definition at line 365 of file User.php.
368 return $query->leftJoin(
'users as manager',
'users.manager_id',
'=',
'manager.id')->orderBy(
'manager.first_name', $order)->orderBy(
'manager.last_name', $order);
App\Models\User::scopeTextsearch |
( |
|
$query, |
|
|
|
$search |
|
) |
| |
Query builder scope to search on text.
- Parameters
-
Illuminate\Database\Query\Builder | $query | Query builder instance |
text | $search | Search term |
- Returns
- Illuminate Modified query builder
Definition at line 318 of file User.php.
321 return $query->where(
function ($query) use ($search) {
322 $query->where(
'users.first_name',
'LIKE',
"%$search%")
323 ->orWhere(
'users.last_name',
'LIKE',
"%$search%")
324 ->orWhere(
'users.email',
'LIKE',
"%$search%")
325 ->orWhere(
'users.username',
'LIKE',
"%$search%")
326 ->orWhere(
'users.notes',
'LIKE',
"%$search%")
327 ->orWhere(
'users.employee_num',
'LIKE',
"%$search%")
328 ->orWhere(
function ($query) use ($search) {
329 $query->whereHas(
'userloc',
function ($query) use ($search) {
330 $query->where(
'locations.name',
'LIKE',
'%'.$search.
'%');
335 ->orWhere(
function ($query) use ($search) {
336 $query->whereRaw(
"users.manager_id IN (select id from users where first_name LIKE '%".$search.
"%' OR last_name LIKE '%".$search.
"%') ");
App\Models\User::sentryThrottle |
( |
| ) |
|
Definition at line 225 of file User.php.
227 return $this->hasOne(
'\App\Models\Throttle');
App\Models\User::uploads |
( |
| ) |
|
Get uploads for this asset.
Definition at line 216 of file User.php.
218 return $this->hasMany(
'\App\Models\Actionlog',
'asset_id')
219 ->where(
'asset_type',
'=',
'user')
220 ->where(
'action_type',
'=',
'uploaded')
221 ->whereNotNull(
'filename')
222 ->orderBy(
'created_at',
'desc');
App\Models\User::userloc |
( |
| ) |
|
Get the asset's location based on the assigned user.
Definition at line 171 of file User.php.
173 return $this->belongsTo(
'\App\Models\Location',
'location_id')->withTrashed();
App\Models\User::userlog |
( |
| ) |
|
Get action logs for this user.
Definition at line 163 of file User.php.
165 return $this->hasMany(
'\App\Models\Actionlog',
'checkedout_to')->orderBy(
'created_at',
'DESC')->withTrashed();
App\Models\User::$dates = ['deleted_at'] |
|
protected |
App\Models\User::$fillable = ['first_name', 'last_name', 'email','password','username'] |
|
protected |
App\Models\User::$injectUniqueIdentifier = true |
|
protected |
Initial value:= [
'first_name' => 'required|string|min:1'
Definition at line 33 of file User.php.
App\Models\User::$table = 'users' |
|
protected |
The documentation for this class was generated from the following file: