고요빛물결

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

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

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/

 

댓글을 작성하시려면 로그인이 필요합니다.
+
분류 제목 글쓴이 날짜 조회
기타 18-10-02 조회 2,935
기타 18-09-30 조회 2,474
라라벨
[라라벨]
18-09-29 조회 3,062
라라벨 18-09-28 조회 2,027
라라벨 18-09-27 조회 7,349
기타 18-04-05 조회 2,479
라라벨 18-03-28 조회 2,873
라라벨
[라라벨]
18-03-26 조회 2,369
라라벨 18-03-25 조회 2,432
라라벨 18-03-25 조회 2,427
코드이그나이터 18-03-18 조회 3,446
라라벨 18-02-23 조회 2,102
라라벨 18-02-23 조회 2,132
기타 18-02-04 조회 2,303
라라벨 18-01-31 조회 2,314
라라벨 17-12-31 조회 2,488
기타 17-12-14 조회 2,319
일반
[일반]
17-12-13 조회 2,580
라라벨 17-11-28 조회 1,810
라라벨 17-11-23 조회 2,603
라라벨 17-11-23 조회 2,793
기타 17-11-22 조회 2,514
라라벨 17-11-21 조회 1,970
라라벨 17-11-19 조회 1,690
라라벨 17-11-17 조회 2,162
라라벨 17-11-16 조회 2,133
라라벨 17-11-15 조회 2,100
기타 17-11-14 조회 2,276
라라벨 17-11-14 조회 2,708
기타 17-11-12 조회 4,162