laravel-shift / factory-generator

MIT License
41 stars 20 forks source link

Get proper cased method names #24

Closed nuernbergerA closed 2 years ago

nuernbergerA commented 2 years ago

get_class_methods will return only public accessible method Visibility example from the docs Usage in laravel ecosystem

jasonmccreary commented 2 years ago

If possible, it'd be nice to see some memoization here as not to run get_class_methods for every column. This really only needs to be run once for the entire lifecycle (i.e. static).

nuernbergerA commented 2 years ago

@jasonmccreary would it be ok for you to store it in the container? app()->instance('faker-methods', [])

we could do this in getNamesFromProvider

jasonmccreary commented 2 years ago

This isn't part of a Laravel app. So there is not app().

You can make the method static and track a static variable. Here's a good article if you're not familiar.

nuernbergerA commented 2 years ago

@jasonmccreary done