@@ -48,15 +48,15 @@ public function types(): array
48
48
49
49
protected function populateStub (string $ stub , Model $ model )
50
50
{
51
- $ stub = str_replace ('DummyNamespace ' , $ model ->fullyQualifiedNamespace (), $ stub );
52
- $ stub = str_replace ('DummyClass ' , $ model ->name (), $ stub );
53
- $ stub = str_replace ('/** DummyPHPDocClass **/ ' , $ this ->buildClassPhpDoc ($ model ), $ stub );
51
+ $ stub = str_replace ('{{ namespace }} ' , $ model ->fullyQualifiedNamespace (), $ stub );
52
+ $ stub = str_replace ('{{ class }} ' , $ model ->name (), $ stub );
53
+ $ stub = str_replace ('{{ PHPDoc }} ' , $ this ->buildClassPhpDoc ($ model ), $ stub );
54
54
55
55
$ body = $ this ->buildProperties ($ model );
56
56
$ body .= PHP_EOL .PHP_EOL ;
57
57
$ body .= $ this ->buildRelationships ($ model );
58
58
59
- $ stub = str_replace ('// ... ' , trim ($ body ), $ stub );
59
+ $ stub = str_replace ('{{ body }} ' , trim ($ body ), $ stub );
60
60
$ stub = $ this ->addTraits ($ model , $ stub );
61
61
62
62
return $ stub ;
@@ -187,10 +187,10 @@ protected function buildRelationships(Model $model)
187
187
} elseif (in_array ($ type , ['hasMany ' , 'belongsToMany ' , 'morphMany ' ])) {
188
188
$ method_name = Str::plural ($ column_name );
189
189
}
190
- $ method = str_replace ('DummyName ' , Str::camel ($ method_name ), $ template );
190
+ $ method = str_replace ('{{ method }} ' , Str::camel ($ method_name ), $ template );
191
191
$ method = str_replace ('null ' , $ relationship , $ method );
192
192
193
- $ phpDoc = str_replace ('DummyReturn ' , '\Illuminate\Database\Eloquent\Relations \\' .Str::ucfirst ($ type ), $ commentTemplate );
193
+ $ phpDoc = str_replace ('{{ namespacedReturnClass }} ' , '\Illuminate\Database\Eloquent\Relations \\' .Str::ucfirst ($ type ), $ commentTemplate );
194
194
195
195
$ methods .= PHP_EOL .$ phpDoc .$ method ;
196
196
}
0 commit comments