고요빛물결

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

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

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/

 

|
댓글을 작성하시려면 로그인이 필요합니다.
+
분류 제목 글쓴이 날짜 조회
라라벨
[라라벨]
19-03-12 조회 2,794
기타 19-03-12 조회 2,431
기타 19-02-28 조회 3,170
라라벨 19-02-27 조회 2,589
기타 19-02-27 조회 2,561
라라벨 19-02-21 조회 3,004
라라벨 19-02-19 조회 2,255
라라벨 19-01-20 조회 2,662
라라벨 19-01-19 조회 3,764
라라벨 19-01-16 조회 2,247
기타 19-01-16 조회 1,996
라라벨 19-01-15 조회 2,669
라라벨 19-01-15 조회 3,590
라라벨 19-01-15 조회 2,677
라라벨 19-01-14 조회 2,633
라라벨 19-01-14 조회 1,864
라라벨 19-01-14 조회 2,465
라라벨 19-01-13 조회 2,585
라라벨 19-01-13 조회 5,999
코드이그나이터 19-01-13 조회 7,365
라라벨 19-01-12 조회 1,875
라라벨 19-01-12 조회 1,776
라라벨 19-01-11 조회 1,775
라라벨 19-01-11 조회 1,805
라라벨 19-01-11 조회 2,215
라라벨 19-01-10 조회 1,708
라라벨 19-01-10 조회 1,843
라라벨 19-01-10 조회 1,999
기타 19-01-09 조회 1,646
라라벨 19-01-09 조회 2,098