@@ -66,7 +66,7 @@ public function handle(): int
6666 public function generateAllPolicies (): void
6767 {
6868 $ this ->getModels ()->each (
69- fn (string $ model ) => $ this ->generatePolicy ($ model , $ model )
69+ fn (string $ model ) => $ this ->generatePolicy ($ model , $ model )
7070 );
7171 }
7272
@@ -80,7 +80,7 @@ public function generatePlainPolicy(string $name): void
8080 {
8181 if (
8282 file_exists ($ this ->getPolicyPath ($ name )) &&
83- !$ this ->option ('force ' )
83+ ! $ this ->option ('force ' )
8484 ) {
8585 $ this ->error (sprintf ('Policy "%s" already exists! ' , $ name ));
8686
@@ -92,8 +92,8 @@ public function generatePlainPolicy(string $name): void
9292 'namespace ' => $ this ->getNamespace (),
9393 'class ' => $ this ->getClassName ($ name ),
9494 ])->reduce (
95- fn ($ carry , $ value , $ key ) => Str::replace (
96- '{{ ' . $ key . ' }} ' ,
95+ fn ($ carry , $ value , $ key ) => Str::replace (
96+ '{{ ' . $ key. ' }} ' ,
9797 $ value ,
9898 $ carry
9999 )
@@ -113,7 +113,7 @@ private function generatePolicy(string $name, string $model): void
113113 {
114114 if (
115115 file_exists ($ this ->getPolicyPath ($ name )) &&
116- !$ this ->option ('force ' )
116+ ! $ this ->option ('force ' )
117117 ) {
118118 $ this ->error (sprintf ('Policy "%s" already exists! ' , $ name ));
119119
@@ -123,8 +123,7 @@ private function generatePolicy(string $name, string $model): void
123123 $ compiled = collect ([
124124 'name ' => $ name ,
125125 'model ' => $ model ,
126- 'modelVariable ' =>
127- strtolower ($ model ) ===
126+ 'modelVariable ' => strtolower ($ model ) ===
128127 strtolower (
129128 Str::afterLast ($ this ->getNamespacedUserModel (), '\\' )
130129 )
@@ -138,8 +137,8 @@ private function generatePolicy(string $name, string $model): void
138137 'namespacedUserModel ' => $ this ->getNamespacedUserModel (),
139138 'user ' => Str::afterLast ($ this ->getNamespacedUserModel (), '\\' ),
140139 ])->reduce (
141- static fn ($ old , $ value , $ key ) => Str::replace (
142- '{{ ' . $ key . ' }} ' ,
140+ static fn ($ old , $ value , $ key ) => Str::replace (
141+ '{{ ' . $ key. ' }} ' ,
143142 $ value ,
144143 $ old
145144 ),
@@ -157,7 +156,7 @@ private function generatePolicy(string $name, string $model): void
157156 */
158157 public function getPolicyPath (string $ name ): string
159158 {
160- return app_path ('Policies/ ' . $ this ->getClassName ($ name ) . '.php ' );
159+ return app_path ('Policies/ ' . $ this ->getClassName ($ name ). '.php ' );
161160 }
162161
163162 /**
@@ -167,7 +166,7 @@ public function getPolicyPath(string $name): string
167166 */
168167 public function getNamespace (): string
169168 {
170- return app ()->getNamespace () . 'Policies ' ;
169+ return app ()->getNamespace (). 'Policies ' ;
171170 }
172171
173172 /**
@@ -182,7 +181,7 @@ public function getClassName(string $name): string
182181 return Str::studly ($ name );
183182 }
184183
185- return Str::studly ($ name ) . 'Policy ' ;
184+ return Str::studly ($ name ). 'Policy ' ;
186185 }
187186
188187 /**
@@ -193,7 +192,7 @@ public function getClassName(string $name): string
193192 */
194193 public function getNamespacedModel (string $ model ): string
195194 {
196- return app ()->getNamespace () . 'Models \\' . Str::studly ($ model );
195+ return app ()->getNamespace (). 'Models \\' . Str::studly ($ model );
197196 }
198197
199198 /**
@@ -213,6 +212,6 @@ public function getNamespacedUserModel(): string
213212 */
214213 public function getStub (): string
215214 {
216- return __DIR__ . '/stubs/policy.stub ' ;
215+ return __DIR__ . '/stubs/policy.stub ' ;
217216 }
218217}
0 commit comments