1 year ago

Should I repeat separate or reuse a nested controller that has overlapping purpose?

Posted 1 year ago by taf


I'm still working away with learning Laravel and my current project will include some videos. They will be quite straight forward and of a format like:

  • name
  • description
  • video_path
  • etc.

The project is framed where there will be multiple controllers that will have associated videos. For example, SkillsController, FlexibilityController, StrengthController, etc. all will have the same type of video components.

Would I be better to use a single VideosController and then set up nullable _id fields? Then when I want to access specific content I could use where().

Alternatively would it be better to create multiple nested Video controllers? i.e. SkillsVideosController, FlexibilityVideosController, etc.

I hope I'm articulating this well.


Please sign in or create an account to participate in this conversation.