Exemplo n.º 1
0
 /**
  * Get all roles the user is attached to.
  *
  * @return EloquentCollection
  */
 public function roles()
 {
     return $this->belongsToMany(Role::class, Guardian::getUsersRolesTable());
 }
Exemplo n.º 2
0
 /**
  * Get all users that are attached to the role.
  * 
  * @return BelongsToMany
  */
 public function users()
 {
     return $this->belongsToMany(Guardian::getUserClass(), Guardian::getUsersRolesTable(), 'role_id', 'user_id')->withTimestamps();
 }