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(); } }