Adding Comments to Posts
What is the best way to provide the ability to post comments on a Post? It standard practice for a blog>
6 Replies
There are many ways, which don't really depend on Twill. This is a good package: https://spatie.be/docs/laravel-comments/v1/introduction
Introduction | laravel-comments
laravel-comments
If you want to manage comments in twill, I'd recommend creating a comments module that has a belongsTo relationship with Posts, or a polymorphic relationship if you're looking to use comments on multiple models
Hang on. The comments are to be added from the front end. i.e a user commenting on a post, and not from the admin interface. So in twill is there a way to add a form to the module. A form that will be displayed on the frontend. Similar to disqus ?
I didn't mean that comments would be added from the admin. I was asking if you wanted to manage (like moderate) comments from the admin after they have been created from the frontend. As far as embedding a commenting module to your page from twill, it could take many forms, but a block with a field to put an embed would be the minimal solution with an external service like disqus.
i was using disqus as an example, what i would want is a comment system build using twill
with only authenticated people allowed to comment
@ifox.dev
You don't need to ping me, please be patient.
What you're asking is not a Twill feature, it'd be feature of your Laravel application. Are the users that would authenticate to post comments the same users that can login to the CMS? If yes, you can use the
twill_users
guard on your comments post route. If not, it'd be something fully managed outside of Twill using the standard Laravel user model. The fact that you want to add a form to your frontend has little to do with the content in the CMS, unless it's optional for your admins to decide if they want to enable comments on a post or not, that would make sense to manage in Twill, but the fact of adding the form to your page would happen in your code.