-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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.6] Creates --api flag during make:controller to exclude #create and #edit methods #22920
Conversation
Similar to #21865 |
I like this idea. Couple of issues though:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ozairp/framework"
}
],
Result: controller is empty
Result: controller contains Second, this code: $stub = null;
if ($this->option('parent')) {
return __DIR__.'/stubs/controller.nested.stub';
} elseif ($this->option('model')) {
return __DIR__.'/stubs/controller.model.stub';
} elseif ($this->option('resource')) {
return __DIR__.'/stubs/controller.stub';
}
if ($this->option('api') && $stub !== null) {
$stub = substr_replace($stub, '.api', -5, 0);
} If I'm not mistaken, in the condition of the last Next,
It seems like ['api', 'a', InputOption::VALUE_NONE, 'Generate a api resource controller class.'], instead of ['api', 'a', InputOption::VALUE_OPTIONAL, 'Generate a api resource controller class.'], Last, I think, since the feature is backwards compatible, you can do the PR to the 5.5 branch. P.S. Why are you naming your commits in the third person?😄 |
I am closing this pull request because it lacks sufficient explanation, tests, or both. It is difficult for us to merge pull requests without these things because the change may introduce breaking changes to the framework. Feel free to re-submit your change with a thorough explanation of the feature and tests - integration tests are preferred over unit tests. Please include it's benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc. Thanks! |
Closing since apparently broken. |
@taylorotwell @KKSzymanowski Thanks for the feedback, first PR to laravel/framework and pretty new to OOS! I'll resubmit the PR with your critiques in mind. |
There's a free lesson at Laracasts showing how to prepare a PR(https://laracasts.com/series/how-do-i/episodes/20). From 4:55 Jeffrey talks about how to pull in your own fork instead of Laravel Framework to test if your changes work. It might be helpful for you. |
An optional flag
--api
is added to themake:controller
command which will not generate #create and #edit methods which are not used for API requests.This is referenced in the Laravel docs under the Controllers section titled
API Resource Routes
which registers resources without #create #edit.https://laravel.com/docs/5.5/controllers#resource-controllers