laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

laravel() helper for application info #2381

Open dillingham opened 3 years ago

dillingham commented 3 years ago

Would be cool if Laravel provided a helper that returned various info about the application.

Useful for package & CLI development mostly I imagine. Maybe other use cases?

laravel()->routes()

laravel()->models()

laravel()->tables()

Maybe returns a collection of objects with basic info.

laravel()->tables()->pluck('name', 'columns');
laravel()->routes()->pluck('name', 'controller', 'middleware');
laravel()->models()->pluck('basename', 'namespace', 'primary_key');
dillingham commented 3 years ago

Wouldn't work for DDD as @martinbean pointed out on discord