private function assignPermissions(Collection $permissions) {
        $roles = Role::whereIn('id', $this->role_ids)->get();

        if ($roles && $permissions) {
            $permission_ids = $permissions->lists('id')->all();

            foreach ($roles as $role) {
                $role->permissions()->attach($permission_ids);
            }
        }
    }
private function assignPermissions(Collection $permissions) {
        $roles = Role::whereIn('id', $this->role_ids)->get();

        if ($roles && $permissions) {
            $permission_ids = $permissions->lists('id')->all();

            foreach ($roles as $role) {
                $role->permissions()->attach($permission_ids);
            }
        }
    }
private function assignPermissions ( Collection $ permissions ) { $ roles = Role :: whereIn ( 'id' , $ this -> role_ids ) -> get ( ) ; if ( $ roles && $ permissions ) { $ permission_ids = $ permissions -> lists ( 'id' ) -> all ( ) ; foreach ( $ roles as $ role ) { $ role -> permissions ( ) -> attach ( $ permission_ids ) ; } } }
Assign permissions to roles

@param Collection $permissions
Assign permissions to roles