Team-Tea-Time/laravel-forum

Customization in controllers.

vermarohitrk1 opened this issue · 1 comments

Hi there,

I have a question regarding customizing the backend. I'm interested in adding tags and making other customizations. Is it possible to achieve this level of customization? I appreciate any guidance or suggestions you can provide.

Thank you!

Riari commented

Hi!

For implementing a new feature such as tagging, the most direct approach would be to implement your own models/routes/controllers and override the forum views to expose the functionality.

Using your example of tags, you could:

  • Show a list of tags below the thread titles when viewing a category or a single thread (you could achieve this with a view composer or by reading tags from a REST endpoint)
  • Show an 'edit' link or button to open up a modal dialog for editing the tags (which could be an action limited to the thread author if you implement a custom policy for tag features)

It gets more complicated if you want to extend or modify an existing package feature because the package controllers aren't designed to be modified (this helps a lot with maintaining backwards compatibility when I do new releases). That said, you can do quite a lot with events - these allow you to execute custom logic in response to any BREAD/CRUD action.

I hope that's useful! If you run into any specific difficulties while customising anything, feel free to comment here again and I'll do my best to help out.

Thanks