Ejemplo n.º 1
0
 /**
  * Associate a user with the provided group / group name.
  *
  * @param string|Collection $group
  * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
  */
 public function assignGroup($group)
 {
     if (is_string($group)) {
         //            return $this->groups->contains('name', $group);
         Models\Group::whereName($group)->firstOrFail();
     }
     return $group->intersect($this->groups);
 }