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

· 7년 전 · 1109

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/

 

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

PHP프레임워크

+
분류 제목 글쓴이 날짜 조회
라라벨 7년 전 조회 2,091
라라벨 7년 전 조회 3,053
라라벨 7년 전 조회 2,106
라라벨 7년 전 조회 2,082
라라벨 7년 전 조회 1,260
라라벨 7년 전 조회 2,016
라라벨 7년 전 조회 2,010
라라벨 7년 전 조회 5,420
코드이그나이터 7년 전 조회 6,720
라라벨 7년 전 조회 1,300
라라벨 7년 전 조회 1,266
라라벨 7년 전 조회 1,198
라라벨 7년 전 조회 1,242
라라벨 7년 전 조회 1,640
라라벨 7년 전 조회 1,110
라라벨 7년 전 조회 1,273
라라벨 7년 전 조회 1,455
기타 7년 전 조회 1,144
라라벨 7년 전 조회 1,542
라라벨 7년 전 조회 1,122
라라벨 7년 전 조회 1,441
라라벨 7년 전 조회 993
라라벨 7년 전 조회 1,004
라라벨 7년 전 조회 1,655
라라벨 7년 전 조회 1,507
기타 7년 전 조회 1,612
라라벨 7년 전 조회 1,222
라라벨 7년 전 조회 1,094
라라벨 7년 전 조회 3,841
라라벨 7년 전 조회 1,233
🐛 버그신고