public function getCompleteRole(int $role_id = null)
    {

        $roles = RoleModel::with('permissions', 'groups', 'affiliations');

        if (! is_null($role_id)) {

            $roles = $roles->where('id', $role_id)->first();

            if (! $roles) abort(404);

            return $roles;
        }

        return $roles->get();
    }
public function getCompleteRole(int $role_id = null)
    {

        $roles = RoleModel::with('permissions', 'groups', 'affiliations');

        if (! is_null($role_id)) {

            $roles = $roles->where('id', $role_id)->first();

            if (! $roles) abort(404);

            return $roles;
        }

        return $roles->get();
    }
public function getCompleteRole ( int $ role_id = null ) { $ roles = RoleModel :: with ( 'permissions' , 'groups' , 'affiliations' ) ; if ( ! is_null ( $ role_id ) ) { $ roles = $ roles -> where ( 'id' , $ role_id ) -> first ( ) ; if ( ! $ roles ) abort ( 404 ) ; return $ roles ; } return $ roles -> get ( ) ; }
Return everything related to the Role
with eager loading.

@param int $role_id

@return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Collection
Return everything related to the Role with eager loading .