{"id":19300044,"url":"https://github.com/kirschbaum-development/nova-comments","last_synced_at":"2025-04-04T07:05:31.861Z","repository":{"id":37318495,"uuid":"183056499","full_name":"kirschbaum-development/nova-comments","owner":"kirschbaum-development","description":"A commenting tool for Laravel Nova","archived":false,"fork":false,"pushed_at":"2025-02-22T17:07:39.000Z","size":1038,"stargazers_count":33,"open_issues_count":14,"forks_count":37,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-28T06:05:25.509Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kirschbaum-development.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-23T16:39:47.000Z","updated_at":"2024-12-31T20:08:39.000Z","dependencies_parsed_at":"2025-01-17T15:06:23.927Z","dependency_job_id":"5f83deb1-05c1-45d8-a360-9dbfec5d9bf7","html_url":"https://github.com/kirschbaum-development/nova-comments","commit_stats":{"total_commits":69,"total_committers":7,"mean_commits":9.857142857142858,"dds":0.6811594202898551,"last_synced_commit":"bcaa29622e6379a20269661a484b77851645ab2d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-comments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-comments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-comments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-comments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirschbaum-development","download_url":"https://codeload.github.com/kirschbaum-development/nova-comments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135142,"owners_count":20889420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-09T23:13:30.551Z","updated_at":"2025-04-04T07:05:31.827Z","avatar_url":"https://github.com/kirschbaum-development.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A commenting resource tool for Nova apps\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/kirschbaum-development/nova-comments.svg)](https://packagist.org/packages/kirschbaum-development/nova-comments)\n[![Total Downloads](https://img.shields.io/packagist/dt/kirschbaum-development/nova-comments.svg)](https://packagist.org/packages/kirschbaum-development/nova-comments)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d3cc58ebefe2480da123f95d43ce1fcc)](https://app.codacy.com/app/Kirschbaum/nova-comments?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=kirschbaum-development/nova-comments\u0026utm_campaign=Badge_Grade_Dashboard)\n\nThis package contains an inline commenting form for any resource to easily add comments. Think a simple version of Disqus for Nova!\n\n###### Commenter Tool\n![screenshot of the commenter resource tool](https://raw.githubusercontent.com/kirschbaum-development/nova-comments/master/screenshots/commenter.png)\n\n###### Simple Comment Panel\n![screenshot of the comments panel](https://raw.githubusercontent.com/kirschbaum-development/nova-comments/master/screenshots/comments-panel.png)\n\n## Requirements\n\nThis Nova resource tool requires Nova 4.0 or higher.  \nFor older version of Nova, use the tagged version [1.0.2](https://github.com/kirschbaum-development/nova-comments/releases/tag/1.0.2)\n\n## Installation\n\nYou can install this package in a Laravel app that uses [Nova](https://nova.laravel.com) via composer:\n\n```bash\ncomposer require kirschbaum-development/nova-comments\n```\n\nNext, we need to run migrations. Auto-discovery of this package's service provider helps with that!\n\n```bash\nphp artisan migrate\n```\n\nAnd lastly, any model that you want to have comments needs the `Commentable` trait added to it.\n\n```php\nuse KirschbaumDevelopment\\NovaComments\\Commentable;\n\nclass Post extends Model\n{\n    use Commentable;\n    \n    // ...\n}\n```\n\nIf you would like to publish the config for this package, run:\n\n```bash\nphp artisan vendor:publish\n```\nAnd choose the provider for this package: `KirschbaumDevelopment\\NovaComments\\NovaCommentsServiceProvider`\n\nThis package requires that it has a commenter, which is simply a `User`. Nova Comments automatically defaults to the `App\\Nova\\User` resource, but can easily be changed in the publishable config file.\n\n## Usage\n\nThere are two components that ship with this package, the `Commenter` and a `CommentsPanel`.\n\n### Commenter\n\nThe first, and most useful, component is the `Commenter`. It is a resource tool that allows you to insert a commenting panel directly onto any Nova resource. This panel allows you to add a comment directly to a resource without needing to create one from the respective create view. The newly created comments show up below the commenting form with live updating.\n\nSimply add the `KirschbaumDevelopment\\NovaComments\\Commenter` resource tool in your Nova resource:\n\n```php\nnamespace App\\Nova;\n\nuse KirschbaumDevelopment\\NovaComments\\Commenter;\n\nclass Post extends Resource\n{\n    // ...\n    \n    public function fields(Request $request)\n    {\n        return [\n            // ...\n            \n            new Commenter(),\n\n            // ...\n        ];\n    }\n}\n```\n\nNow you can comment from the detail view of any resource you've attached the `Commenter` to! Happy commenting!\n\n### Comments Panel\n\nAs a convenience, a prebuilt comments panel has been created for you. All you need to do is simply add it to your resource and enjoy the pre-built goodness.\n\n```php\nnamespace App\\Nova;\n\nuse KirschbaumDevelopment\\NovaComments\\Commenter;\n\nclass Post extends Resource\n{\n    // ...\n    \n    public function fields(Request $request)\n    {\n        return [\n            // ...\n            \n            new CommentsPanel(),\n\n            // ...\n        ];\n    }\n}\n```\n\nOf course you are completely free to create your own comments panel, but to get up and running quickly, we recommend using this panel.\n\n### Sidebar Navigation\n\nOccasionally you may want to hide comments from the sidebar. You can easily do this by setting the respective config value to false. Make sure to first publish the configs.\n\n```php\n'available-for-navigation' =\u003e false\n```\n\n### Pagination caveat\n\nDue to an limitation in how Nova paginates results, there is currently no way to set the `perPage` value for the number of comments that will display at a time from a configuration value. Nova's default value is 5 per page. If you would like to set this to a different value, such as 25, we recommend you extend the `Commenter` and set this value with the follwing code:\n\n```php\nuse KirschbaumDevelopment\\NovaComments\\Commenter as NovaCommenter;\n\nclass Commenter extends NovaCommenter\n{\n    /**\n     * The number of resources to show per page via relationships.\n     *\n     * @var int\n     */\n    public static $perPageViaRelationship = 25;\n}\n```\n\nThen use this class instead of the default `Commenter` class within your resources.\n\n### Customizing the comment\n\nBy default, the `Comment` model will strip tags from the comment body. If you would like to modify this behavior, you can pass an callback to the `Comment::whenCreating` method. This callback will receive the comment model instance as a parameter.\n\n```php\nComment::whenCreating(function (Comment $comment) {\n    $comment-\u003ecomment = strip_tags($comment-\u003ecomment);\n});\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email brandon@kirschbaumdevelopment.com or nathan@kirschbaumdevelopment.com instead of using the issue tracker.\n\n## Credits\n\n- [Brandon Ferens](https://github.com/brandonferens)\n\n## Sponsorship\n\nDevelopment of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com) or [join us](https://careers.kirschbaumdevelopment.com)!\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirschbaum-development%2Fnova-comments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirschbaum-development%2Fnova-comments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirschbaum-development%2Fnova-comments/lists"}