Extensions:Comments

From Lorekeeper Wiki
Revision as of 15:11, 1 November 2020 by Mercury (talk | contribs)
Jump to navigation Jump to search
Comments
Description Adds comments and a sales area to lorekeeper.
Author(s) Ne-wt, Preimpression
Status stable
Github comments-addon
LK Version Unspecified
Contains a Migration
Is part of LK v2 (modified-main)



Add comments to your sites! Comments will notify users when commented on and replied to.

Mentions are not yet developed, unfortunately.

Thanks

Special thank you to Uri (Preimpression) who not only helped make this project possible, but significantly reduced its development time. Please consider donating to their ko-fi!

https://ko-fi.com/preimpression

Also thanks to Laravelista for providing the original package.

Installation

As of October 8, 2020, the Comments extension has been separated from the original package. As always, we highly recommend installing locally and testing on a local testing server (via XAMPP or something similar) to ensure everything is working.

  1. Pull the branch (comments-addon) and merge. Make sure to check your conflicts manually - don't rely on Sourcetree to handle the merge!
  2. Run the command: composer update so that your server will ensure it has some of the minor packages (such as Honeypot by Spatie, which is spam-prevention package).
    • You may need to include composer.lock in this push if you are on a limited hosting plan and composer complains about memory.
  3. Run the command: php artisan migrate so that Laravel will update the database accordingly.
  4. If you had the package prior to the October 8 update, run php artisan view:clear to clear your view caches.

I recommend playing with comments before repeating the process for your production site. This will allow you to catch any errors before it can affect your site. Please let me know if you happen to find any. If you encounter any errors please let me know!

Configuration

Comments come with the following extensions installed:

  • User Avatars
  • Sales Page Addon
  • User Ranks Icon Addon

If you do not wish to use these please consider removing before pushing to your site.

Usage

To add comments to a new page, add the following:

  • Add use App\Traits\Commentable; to the top of your model
  • Add use Commentable; within the curly brackets (e.g Controller extends Controller { use Commentable;)
  • Add @comments([ 'model' => $modelvariable, 'perPage' => 5 ]) to your view
  • You will also need to update your Notifications inside CommentController to handle whatever new system you're adding comments to.

Troubleshooting

If you need support please @ me in the lorekeeper discord, Newt#7776. Please note I heavily advise testing on local before pushing to production.

See Also

If you have errors, try clearing your laravel caches before anything!