src/Conductors/AssignsRoles.php
protected function createMissingAssignRecords(Collection $records, Collection $existing)
    {
        $existing = $existing->keyBy(function ($record) {
            return $this->getAttachRecordHash((array) $record);
        });

        $records = $records->reject(function ($record) use ($existing) {
            return $existing->has($this->getAttachRecordHash($record));
        });

        $this->newPivotTableQuery()->insert($records->all());
    }
protected function createMissingAssignRecords(Collection $records, Collection $existing)
    {
        $existing = $existing->keyBy(function ($record) {
            return $this->getAttachRecordHash((array) $record);
        });

        $records = $records->reject(function ($record) use ($existing) {
            return $existing->has($this->getAttachRecordHash($record));
        });

        $this->newPivotTableQuery()->insert($records->all());
    }
protected function createMissingAssignRecords ( Collection $ records , Collection $ existing ) { $ existing = $ existing -> keyBy ( function ( $ record ) { return $ this -> getAttachRecordHash ( ( array ) $ record ) ; } ) ; $ records = $ records -> reject ( function ( $ record ) use ( $ existing ) { return $ existing -> has ( $ this -> getAttachRecordHash ( $ record ) ) ; } ) ; $ this -> newPivotTableQuery ( ) -> insert ( $ records -> all ( ) ) ; }
Save the non-existing attach records in the DB.

@param  \Illuminate\Support\Collection  $records
@param  \Illuminate\Support\Collection  $existing
@return void
Save the non - existing attach records in the DB .