@@ -12,7 +12,7 @@ trait DatabaseFunctions
1212 public Builder $ builder ;
1313
1414 protected array $ providers = [
15- " pgsql " => PgSQLFunctions::class,
15+ ' pgsql ' => PgSQLFunctions::class,
1616 ];
1717
1818 protected function areArgumentsValid (): void
@@ -25,28 +25,29 @@ protected function areArgumentsValid(): void
2525
2626 private function applyAggregation (array $ params ): string
2727 {
28- $ column = array_pop ($ params );
29- $ provider = $ this ->builder ->getModel ()->connection ?? config (" database.default " );
28+ $ column = array_pop ($ params );
29+ $ provider = $ this ->builder ->getModel ()->connection ?? config (' database.default ' );
3030 $ functions = $ this ->providers [$ provider ] ?? SQLFunctions::class;
3131
3232 return array_reduce (array_reverse ($ params ), function ($ query , $ param ) use (
3333 $ column ,
3434 $ functions
3535 ) {
36- $ stat = $ query ?? ("* " !== $ column ? "\"$ column \"" : $ column );
36+ $ stat = $ query ?? ('* ' !== $ column ? "\"$ column \"" : $ column );
37+
3738 return $ functions ::$ param ($ stat );
3839 });
3940 }
4041
4142 protected function prepareArguments (): void
4243 {
4344 $ this ->arguments = array_map (function ($ argument ) {
44- if (strpos ($ argument , " : " ) === false ) {
45+ if (strpos ($ argument , ' : ' ) === false ) {
4546 return $ argument ;
4647 }
47- $ split = explode (" : " , $ argument );
48+ $ split = explode (' : ' , $ argument );
4849 $ apply = $ this ->applyAggregation ($ split );
49- $ alias = join (" _ " , array_filter ($ split , fn ($ s ) => " * " !== $ s ));
50+ $ alias = join (' _ ' , array_filter ($ split , fn ($ s ) => ' * ' !== $ s ));
5051
5152 return DB ::raw ("{$ apply } as {$ alias }" );
5253 }, $ this ->arguments );
0 commit comments