comparison src/Replacer/Replacer.php @ 45:c7fd31303024 default tip

merging down to default
author Luka Sitas <sitas.luka.97@gmail.com>
date Thu, 12 Nov 2026 21:19:53 -0500
parents 116b36f5e73b
children
comparison
equal deleted inserted replaced
34:f65ab84ee47f 45:c7fd31303024
155 public function routes_name(string $name): string 155 public function routes_name(string $name): string
156 { 156 {
157 return Str::singular(Str::studly($name)); 157 return Str::singular(Str::studly($name));
158 } 158 }
159 159
160 /**
161 * Generate factory name in Studly case.
162 */
163 public function factory_name(string $name): string
164 {
165 return Str::singular(Str::studly($name)) . 'Factory';
166 }
167
168 /**
169 * Generate test name in Studly case.
170 */
171 public function test_name(string $name): string
172 {
173 return Str::singular(Str::studly($name)) . 'Test';
174 }
175
160 // Namespace Methods 176 // Namespace Methods
161 // These methods handle the formation of various namespaces used within the replacements. 177 // These methods handle the formation of various namespaces used within the replacements.
162 178
163 /** 179 /**
164 * Get the root namespace for the application. 180 * Get the root namespace for the application.
265 public function getShowViewNamespace(string $name): string 281 public function getShowViewNamespace(string $name): string
266 { 282 {
267 return $this->getViewNamespace($name) . '\\'; 283 return $this->getViewNamespace($name) . '\\';
268 } 284 }
269 285
286 /**
287 * Get the factory namespace.
288 */
289 public function getFactoryNamespace(string $name = ''): string
290 {
291 return database_path()
292 . DIRECTORY_SEPARATOR . 'factories' ;
293 }
294
295 /**
296 * Get the test namespace.
297 */
298 public function getTestNamespace(string $name = ''): string
299 {
300 return base_path()
301 . DIRECTORY_SEPARATOR . 'tests'
302 . DIRECTORY_SEPARATOR . 'CRUD' ;
303 }
270 304
271 /** 305 /**
272 * Get the request uses string for replacement. 306 * Get the request uses string for replacement.
273 */ 307 */
274 public function getRequestUses(string $name): string 308 public function getRequestUses(string $name): string