@@ -22,7 +22,7 @@ public function output(array $tree): array
2222 {
2323 $ output = [];
2424
25- $ stub = $ this ->files ->get ( STUBS_PATH . ' / model/class.stub ' );
25+ $ stub = $ this ->files ->stub ( ' model/class.stub ' );
2626
2727 /** @var \Blueprint\Models\Model $model */
2828 foreach ($ tree ['models ' ] as $ model ) {
@@ -59,19 +59,19 @@ private function buildProperties(Model $model)
5959
6060 $ columns = $ this ->fillableColumns ($ model ->columns ());
6161 if (!empty ($ columns )) {
62- $ properties .= PHP_EOL . str_replace ('[] ' , $ this ->pretty_print_array ($ columns , false ), $ this ->getStub ( ' fillable ' ));
62+ $ properties .= PHP_EOL . str_replace ('[] ' , $ this ->pretty_print_array ($ columns , false ), $ this ->files -> stub ( ' model/ fillable.stub ' ));
6363 } else {
64- $ properties .= $ this ->getStub ( ' fillable ' );
64+ $ properties .= $ this ->files -> stub ( ' model/ fillable.stub ' );
6565 }
6666
6767 $ columns = $ this ->castableColumns ($ model ->columns ());
6868 if (!empty ($ columns )) {
69- $ properties .= PHP_EOL . str_replace ('[] ' , $ this ->pretty_print_array ($ columns ), $ this ->getStub ( ' casts ' ));
69+ $ properties .= PHP_EOL . str_replace ('[] ' , $ this ->pretty_print_array ($ columns ), $ this ->files -> stub ( ' model/ casts.stub ' ));
7070 }
7171
7272 $ columns = $ this ->dateColumns ($ model ->columns ());
7373 if (!empty ($ columns )) {
74- $ properties .= PHP_EOL . str_replace ('[] ' , $ this ->pretty_print_array ($ columns , false ), $ this ->getStub ( ' dates ' ));
74+ $ properties .= PHP_EOL . str_replace ('[] ' , $ this ->pretty_print_array ($ columns , false ), $ this ->files -> stub ( ' model/ dates.stub ' ));
7575 }
7676
7777 return trim ($ properties );
@@ -88,7 +88,7 @@ private function buildRelationships(Model $model)
8888 }
8989
9090 $ methods = '' ;
91- $ template = $ this ->getStub ( ' method ' );
91+ $ template = $ this ->files -> stub ( ' model/ method.stub ' );
9292
9393 /** @var Column $column */
9494 foreach ($ columns as $ column ) {
@@ -177,17 +177,6 @@ private function pretty_print_array(array $data, $assoc = true)
177177 return trim ($ output );
178178 }
179179
180- private function getStub (string $ stub )
181- {
182- static $ stubs = [];
183-
184- if (empty ($ stubs [$ stub ])) {
185- $ stubs [$ stub ] = $ this ->files ->get (STUBS_PATH . '/model/ ' . $ stub . '.stub ' );
186- }
187-
188- return $ stubs [$ stub ];
189- }
190-
191180 private function addTraits (Model $ model , $ stub )
192181 {
193182 if (!$ model ->usesSoftDeletes ()) {
0 commit comments