laravelista / comments

Native comments for your Laravel application.
MIT License
744 stars 142 forks source link

Permalinking #110

Closed preimpression closed 4 years ago

preimpression commented 4 years ago

[Just spotted your note about permalinking in your reply to my previous issue, so here's the issue for it!]

Meant to thank you for the package in my previous issues but was out of it - thanks so much for the package!

A friend and I are working on similar projects (forked from the same base project) and have been trying to figure out the permalinking, with very little success.

Clarification provided by Newt there, we're wanting the comment (plus its children) to be accessed basically by going to https://website/comments/{comment_id} instead of something like https://website/user/{username}/{comment_id}

mabasic commented 4 years ago

I see. Well, you can use the model Laravelista\Comments\Comment::findOrFail($id) to retrieve any comment from the database.

In your web.php file add a route with the path you want and a parameter for comment id. Then in the controller fetch the comment with the above command amd display it however you want.

Hope this helps you.