고요빛물결

[lavuebd] Group, Board, Post, Comment등의 Resource Controller

· 2019-01-10 (목) 08:35:00 · 1740

php artisan make:controller Group/GroupController -r

php artisan make:controller Board/BoardController -r

php artisan make:controller Post/PostController -r

php artisan make:controller Comment/CommentController -r

 

Route::resource('posts', 'Post\PostController', ['only' => ['index', 'show']]);

Route::resource('posts', 'Post\PostController')->only([

    'index', 'show'

]);

 

HTTP Verb를 보면 5개를 사용합니다. https://www.restapitutorial.com/lessons/httpmethods.html

GET 은 Read

POST는 Create

PUT은 Update/Replace

PATCH는 Update/Modify

DELETE는 Delete 입니다.  그러다 보니

 

GET으로 create와 edit 하는 것은 행동과 단어가 맞지 않아서 가능하면 안쓰는 것이 좋을 것 같습니다.

 

Route::resource('groups', 'Group\GroupController', ['except' => ['create', 'edit']]);

Route::resource('groups', 'Group\GroupController')->except([

    'create', 'edit'

]);

 

PUT과 PATCH는 둘다 update/replace, update/modify인데..  

 

PUT은 레코드 전체를 보내는 것이고, PATCH는 원하는 필드만 보내는 것 같습니다.

 

참조: https://www.testingexcellence.com/difference-put-patch-requests/

 

댓글을 작성하시려면 로그인이 필요합니다.
+
분류 제목 글쓴이 날짜 조회
코드이그나이터 16-12-18 조회 1,370
코드이그나이터
[코드이그나이터]
16-12-16 조회 1,257
코드이그나이터
[코드이그나이터]
16-12-15 조회 1,712
코드이그나이터
[코드이그나이터]
16-12-15 조회 1,390
코드이그나이터
[코드이그나이터]
16-12-14 조회 1,380
코드이그나이터 16-12-14 조회 1,362
코드이그나이터 16-12-14 조회 1,308
라라벨 22-01-18 조회 4,564
라라벨 21-07-06 조회 1,896
기타 21-03-16 조회 2,168
기타 21-01-17 조회 2,593
기타 21-01-10 조회 2,142
라라벨 21-01-02 조회 2,638
라라벨 20-12-12 조회 2,195
라라벨
[라라벨]
20-09-13 조회 3,157
기타 20-08-22 조회 2,344
라라벨 20-06-18 조회 2,989
라라벨 20-06-13 조회 2,451
라라벨 20-04-29 조회 2,330
라라벨 20-04-29 조회 2,686
라라벨 20-03-25 조회 2,090
기타 20-03-15 조회 2,446
라라벨
[라라벨]
20-03-15 조회 2,462
라라벨 20-02-27 조회 1,965
라라벨 20-02-27 조회 2,090
라라벨 20-02-26 조회 2,027
기타 19-12-23 조회 2,773
라라벨 19-09-11 조회 2,617
기타 19-09-08 조회 2,567
기타 19-03-12 조회 2,493