22
33namespace Nanvaie \DatabaseRepository \Commands ;
44
5+ use Illuminate \Support \Str ;
56use Nanvaie \DatabaseRepository \CustomMySqlQueries ;
67use Illuminate \Console \Command ;
78
@@ -30,28 +31,28 @@ class MakeMySqlRepository extends Command
3031 private function writeGetOneFunction (string $ getOneStub , string $ columnName , string $ attributeType ): string
3132 {
3233 return str_replace (['{{ FunctionName }} ' , '{{ ColumnName }} ' , '{{ AttributeType }} ' , '{{ AttributeName }} ' ],
33- [ucfirst (camel_case ($ columnName )), $ columnName , $ attributeType , camel_case ($ columnName )],
34+ [ucfirst (Str:: camel ($ columnName )), $ columnName , $ attributeType , Str:: camel ($ columnName )],
3435 $ getOneStub );
3536 }
3637
3738 private function writeGetAllFunction (string $ getOneStub , string $ columnName , string $ attributeType ): string
3839 {
3940 return str_replace (['{{ FunctionNamePlural }} ' , '{{ ColumnName }} ' , '{{ AttributeType }} ' , '{{ AttributeNamePlural }} ' ],
40- [ucfirst (str_plural ( camel_case ($ columnName ))), $ columnName , $ attributeType , str_plural ( camel_case ($ columnName ))],
41+ [ucfirst (Str:: plural (Str:: camel ($ columnName ))), $ columnName , $ attributeType , Str:: plural (Str:: camel ($ columnName ))],
4142 $ getOneStub );
4243 }
4344
4445 private function writeGetterFunction (string $ getterStub , string $ columnName ): string
4546 {
4647 return str_replace (['{{ ColumnName }} ' , '{{ GetterName }} ' ],
47- [$ columnName , ucfirst (camel_case ($ columnName ))],
48+ [$ columnName , ucfirst (Str:: camel ($ columnName ))],
4849 $ getterStub );
4950 }
5051
5152 private function writeSetterFunction (string $ setterStub , string $ columnName ): string
5253 {
5354 return str_replace ('{{ SetterName }} ' ,
54- ucfirst (camel_case ($ columnName )),
55+ ucfirst (Str:: camel ($ columnName )),
5556 $ setterStub );
5657 }
5758
@@ -64,8 +65,8 @@ public function handle(): int
6465 {
6566 $ tableName = $ this ->argument ('table_name ' );
6667 $ detectForeignKeys = $ this ->option ('foreign-keys ' );
67- $ entityName = str_singular (ucfirst (camel_case ($ tableName )));
68- $ entityVariableName = camel_case ($ entityName );
68+ $ entityName = Str:: singular (ucfirst (Str:: camel ($ tableName )));
69+ $ entityVariableName = Str:: camel ($ entityName );
6970 $ factoryName = $ entityName .'Factory ' ;
7071 $ interfaceName = 'I ' .$ entityName .'Repository ' ;
7172 $ mysqlRepositoryName = 'MySql ' .$ entityName .'Repository ' ;
0 commit comments