public static function makeForModel($model, $attributes)
{
if (is_string($attributes)) {
$attributes = ['name' => $attributes];
}
if ($model == '*') {
return (new static())->forceFill($attributes + ['entity_type' => '*']);
}
if (is_string($model)) {
$model = new $model();
}
return (new static())->forceFill($attributes + ['entity_type' => $model->getMorphClass(), 'entity_id' => $model->exists ? $model->getKey() : null]);
}