File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,12 @@ public function versionable()
48
48
}
49
49
50
50
/**
51
- * @param \Illuminate\Database\Eloquent\Model $model
51
+ * @param \Illuminate\Database\Eloquent\Model $model
52
+ * @param array $attributes
52
53
*
53
54
* @return \Overtrue\LaravelVersionable\Version
54
55
*/
55
- public static function createForModel (Model $ model )
56
+ public static function createForModel (Model $ model, array $ attributes = [] )
56
57
{
57
58
$ versionClass = $ model ->getVersionModel ();
58
59
@@ -61,7 +62,7 @@ public static function createForModel(Model $model)
61
62
$ version ->versionable_id = $ model ->getKey ();
62
63
$ version ->versionable_type = $ model ->getMorphClass ();
63
64
$ version ->{\config ('versionable.user_foreign_key ' )} = \auth ()->id ();
64
- $ version ->contents = $ model ->getVersionableAttributes ();
65
+ $ version ->contents = \array_merge ( $ attributes , $ model ->getVersionableAttributes () );
65
66
66
67
$ version ->save ();
67
68
You can’t perform that action at this time.
0 commit comments