저는 제품, 뉴스, 사용자 등 동적 인 콘텐츠가 포함 된 자체 관리 기관 웹 사이트를 Laravel에 구축하고 있습니다. 컨트롤러 및 모범 사례에 대한 의문이 생겼습니다.엔티티 별 페이지 또는 컨트롤러 별 컨트롤러?
일부 페이지는 완전히 정적 인 반면 (about, services info, ...) 제품 목록과 같이 동적 인 페이지도 있습니다.
컨트롤러를 페이지 또는 엔티티별로 만들어야하는지 잘 모르겠습니다. 예 :
ProductController => shows the page for a single product
ProductsController => shows the page for listing all the products
SearchController => shows the page for searching products
AboutController => shows the about page
ServicesController => shows the page for listing services
vs
ProductsController => shows the page for single and multiple products, and the search products page
PagesController/StaticController => shows all static pages (like "about" and "services")
최상의 방법은 무엇입니까?
그래서 모든 컨트롤러에 대한 모든 페이지를 보여주는를 담당하는 reouts에 인라인을 반환 할 수 같은 주체? 또한 모든 CRUD의 법인 운영? –
예를 들어 "정적 사이트 표시"기능, 하나의 기능, 하나의 책임, 하나의 클래스/컨트롤러가 있습니다. 많은 컨트롤러로 나누면 코드가 중복됩니다. 예 CRUD,하지만 컨트롤러에 로직을 팩하지 마십시오. – Damonsson
감사합니다. 감사합니다! –