Skip to content

docs: update News Tutorial#7427

Merged
kenjis merged 6 commits intocodeigniter4:4.4from
kenjis:docs-update-tutorial
Apr 17, 2023
Merged

docs: update News Tutorial#7427
kenjis merged 6 commits intocodeigniter4:4.4from
kenjis:docs-update-tutorial

Conversation

@kenjis
Copy link
Copy Markdown
Member

@kenjis kenjis commented Apr 13, 2023

Description

Before:

+--------+--------------+------+---------------------------------+----------------+---------------+
| Method | Route        | Name | Handler                         | Before Filters | After Filters |
+--------+--------------+------+---------------------------------+----------------+---------------+
| GET    | /            | »    | \App\Controllers\Home::index    |                | toolbar       |
| GET    | news/create  | »    | \App\Controllers\News::create   |                | toolbar       |
| GET    | news/([^/]+) | »    | \App\Controllers\News::view/$1  |                | toolbar       |
| GET    | news         | »    | \App\Controllers\News::index    |                | toolbar       |
| GET    | pages        | »    | \App\Controllers\Pages::index   |                | toolbar       |
| GET    | ([^/]+)      | »    | \App\Controllers\Pages::view/$1 |                | toolbar       |
| POST   | news/create  | »    | \App\Controllers\News::create   | csrf           | toolbar       |
+--------+--------------+------+---------------------------------+----------------+---------------+

After:

+--------+--------------+------+---------------------------------+----------------+---------------+
| Method | Route        | Name | Handler                         | Before Filters | After Filters |
+--------+--------------+------+---------------------------------+----------------+---------------+
| GET    | /            | »    | \App\Controllers\Home::index    |                | toolbar       |
| GET    | news         | »    | \App\Controllers\News::index    |                | toolbar       |
| GET    | news/new     | »    | \App\Controllers\News::new      |                | toolbar       |
| GET    | news/([^/]+) | »    | \App\Controllers\News::show/$1  |                | toolbar       |
| GET    | pages        | »    | \App\Controllers\Pages::index   |                | toolbar       |
| GET    | ([^/]+)      | »    | \App\Controllers\Pages::view/$1 |                | toolbar       |
| POST   | news         | »    | \App\Controllers\News::create   | csrf           | toolbar       |
+--------+--------------+------+---------------------------------+----------------+---------------+

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added documentation Pull requests for documentation only 4.4 labels Apr 13, 2023
@kenjis kenjis force-pushed the docs-update-tutorial branch from cb52116 to 03a9b9f Compare April 13, 2023 07:44
Copy link
Copy Markdown
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it valuable that we were using $this->request->is('post') in the previous version, but it's not a deal breaker for me. Nice update.

@kenjis
Copy link
Copy Markdown
Member Author

kenjis commented Apr 15, 2023

The create() method and its explanation were too long and it was difficult to read, so I split it into two methods and defined GET and POST routes.

Then $this->request->is() is no longer needed. It would be strange to keep it, so I removed it.

@kenjis kenjis merged commit 700d8ba into codeigniter4:4.4 Apr 17, 2023
@kenjis kenjis deleted the docs-update-tutorial branch April 17, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Pull requests for documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants