Skip to content

Fix typo in controller docs #26

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

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/docs/defining-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ From this definition, Blueprint will generate two controllers. A `PostController

While you may specify the full name of a controller, Blueprint will automatically suffix controller names with `Controller` to follow Laravel's naming conventions. So, for convenience, you may simply specify the root name of the controller - be it singular or plural.

Blueprint will generate the methods for each controller actions. In addition, Blueprint will register routes for each action. The HTTP method will be inferred based on the action name. For example, Blueprint will register a `post` route for the `store` action. Otherwise, a `get` route will be registered.
Blueprint will generate the methods for each controller's actions. In addition, Blueprint will register routes for each action. The HTTP method will be inferred based on the action name. For example, Blueprint will register a `post` route for the `store` action. Otherwise, a `get` route will be registered.

For these reasons, Blueprint recommends defining [resource controllers](/docs/controller-shorthands#resource-shorthand). Doing so allows Blueprint to infer details and generate even more code automatically.

If you wish to namespace a controller, you may prefix the controller name. Blueprint will use this prefix as the namespace and properly save the generated controller class following Laravel conventions. For example, defining an `Api\Post` controller will generate a `App\Http\Controllers\Api\PostController` class saved as `app/Http/Controllers/Api/PostController.php`.

Review the [advanced configuration](/docs/advanced-configuration) to customize these namespaces and paths farther.
Review the [advanced configuration](/docs/advanced-configuration) to customize these namespaces and paths further.

Finally, Blueprint will analyze each of the statements listed within the action to generate the body of each controller method. For example, the above definition for the `index` action would generate the following controller method:

Expand Down