Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Create a resource controller along with the model #15795

Merged
merged 1 commit into from
Oct 10, 2016
Merged

[5.3] Create a resource controller along with the model #15795

merged 1 commit into from
Oct 10, 2016

Conversation

browner12
Copy link
Contributor

it's incredibly common for me to make a resource controller for most of my models, so it'd be nice do it in one line.

while this would be a nicety, I can also see someone arguing that this adds unnecessary complexity, when it's already easy enough to just run the commands one after the other.

curious where you stand on this, because we could just as easily add an option to create a seeder at the same time.

it's incredibly common for me to make a resource controller for most of my models, so it'd be nice do it in one line.

while this would be a nicety, I can also see someone arguing that this adds unnecessary complexity, when it's already easy enough to just run the commands one after the other.

curious where you stand on this, because we could just as easily add an option to create a seeder at the same time.
@GrahamCampbell GrahamCampbell changed the title create a resource controller along with the model [5.3] Create a resource controller along with the model Oct 7, 2016
@taylorotwell
Copy link
Member

taylorotwell commented Oct 9, 2016

One question for me here would be what if I want the controller in a namespace, like API for example?

@browner12
Copy link
Contributor Author

i think when you're adding a nicety like this, you really can't cover all use cases, and what you're going after is a majority. trying to cover everything causes you to add in little hacks that turn the once simple change into messy code.

I would say keep the feature and code simple, and for more complex things (ie namespaced controllers), you can continue to use the dedicated commands.

for me, personally, most of my controllers are never in a namespace, so this covers 99% of my use. maybe it's different for others, would be curious to hear.

@taylorotwell taylorotwell merged commit 3562235 into laravel:5.3 Oct 10, 2016
@browner12 browner12 deleted the patch-2 branch October 10, 2016 13:54
@Modelizer
Copy link
Contributor

Modelizer commented Oct 24, 2016

It's very rare I use a controller without adding namespace. I was thinking can we add Controller Namespace? --cn=YourNamespace option?

Or else we can swap it out like

php artisan make:controller Namespace\ControllerName --model

Here most of the time I put controllers into namespace but keeping Model in its default directory


Also, I was thinking can we set model default directory in a configuration file? This way we can control model not to always create in App directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants