PMC-786
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = "USERS";
|
||||
protected $primaryKey = 'USR_ID';
|
||||
// Our custom timestamp columns
|
||||
const CREATED_AT = 'USR_CREATE_DATE';
|
||||
const UPDATED_AT = 'USR_UPDATE_DATE';
|
||||
@@ -18,4 +19,24 @@ class User extends Model
|
||||
{
|
||||
return $this->hasMany(Delegation::class, 'USR_ID', 'USR_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the user this belongs to
|
||||
*/
|
||||
public function groups()
|
||||
{
|
||||
return $this->belongsTo(GroupUser::class, 'USR_UID', 'USR_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the groups from a user
|
||||
*
|
||||
* @param boolean $usrUid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getGroups($usrUid)
|
||||
{
|
||||
return User::find($usrUid)->groups()->get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user