php - RESTfull controllers with more than CRUD methods -
this don't understand quite making making app self using laravel , upkeep standards.
so have following:
class usercontroller extends basecontroller { index(), show(), new(), edit() post create() put update() delete destroy() } class usermodel { hasmany->assets } class asset { pulic function fetchassetsfromapi(); } now don't have asset controller because there nothing asset needs displayed on it's own. have model orm purposes represent assets table.
now assets model has method pulls assets associated particular user , adds them database.
now view rendered usercontroller->show has button called update assets should call fechassetsfromapi() update characters assets. since there no way invoke alone button have post controller.
meaning need have method in userscontroller since it's 1 using assets model.
now question break rules , guidelines restfull controllers ? have similar dilema appear multiple time in application ho should approach it.
should proper restfull controller contain crud or ?
as far know, having more functions in controller fine, should have public functions crud functions. in case, make link that, when clicked, go same route. means same show() function called, except has been updated pulled page. force refresh of browser page.
Comments
Post a Comment