src/Conductors/AssignsRoles.php
public function to($authority)
    {
        $authorities = is_array($authority) ? $authority : [$authority];

        $roles = Models::role()->findOrCreateRoles($this->roles);

        foreach (Helpers::mapAuthorityByClass($authorities) as $class => $ids) {
            $this->assignRoles($roles, $class, new Collection($ids));
        }

        return true;
    }
public function to($authority)
    {
        $authorities = is_array($authority) ? $authority : [$authority];

        $roles = Models::role()->findOrCreateRoles($this->roles);

        foreach (Helpers::mapAuthorityByClass($authorities) as $class => $ids) {
            $this->assignRoles($roles, $class, new Collection($ids));
        }

        return true;
    }
public function to ( $ authority ) { $ authorities = is_array ( $ authority ) ? $ authority : [ $ authority ] ; $ roles = Models :: role ( ) -> findOrCreateRoles ( $ this -> roles ) ; foreach ( Helpers :: mapAuthorityByClass ( $ authorities ) as $ class => $ ids ) { $ this -> assignRoles ( $ roles , $ class , new Collection ( $ ids ) ) ; } return true ; }
Assign the roles to the given authority.

@param  \Illuminate\Database\Eloquent\Model|array|int  $authority
@return bool
Assign the roles to the given authority .