46 lines
702 B
PHP
46 lines
702 B
PHP
<?php
|
|
|
|
namespace App\Models\Traits\User\Methods;
|
|
|
|
trait UserMethods
|
|
{
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function isSuperAdmin()
|
|
{
|
|
return $this->hasRole(config('access.users.super_admin_role'));
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function isAdmin()
|
|
{
|
|
return $this->hasRole(config('access.users.admin_role'));
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function isActive()
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getRoleName()
|
|
{
|
|
$role = $this->roles->first();
|
|
|
|
if ($role) {
|
|
return $role->name;
|
|
}
|
|
|
|
return '';
|
|
}
|
|
}
|