/**
* Create the pivot table records for assigning the role to given models.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param array $keys
* @return array
*/
protected function createAssignRecords(Model $model, array $keys)
{
$type = $model->getMorphClass();
return array_map(function ($key) use($type) {
return ['role_id' => $this->getKey(), 'entity_type' => $type, 'entity_id' => $key];
}, $keys);
}