-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commenter doesn't work #40
Comments
Running into the same issue. Using Laravel 7 and Nova 3.23.1. |
It can be solved by adding an association in the resource. Should be like this HasMany::make('Comments'). |
This seems to work for me. The error seems to be due to the fact that your commentable resource has to have not only Laravel relation (in the model) but also a field like
<?php
namespace App\Nova;
use KirschbaumDevelopment\NovaComments\Nova\Comment as NovaComment;
class Comment extends NovaComment
{
} The resource you need comments on: //...
/**
* Get the fields displayed by the resource.
*
* @param Request $request
* @return array
*/
public function fields(Request $request)
{
return [
//...
\KirschbaumDevelopment\NovaComments\Commenter::make(),
HasMany::make('Comments', 'comments')->hideFromDetail()->hideFromIndex(),
//...
];
}
//... Maybe theres a better way to do it, but i did not find that. |
Just for the record, you dont need to create a new Nova resource, you can just add the class of in the package, like this:
|
is this package still active and accepting PR? |
@anditsung It is still active, sorry about the delays in responding. We've recently updated the package to support Laravel Nova v4 thanks to another contributor. @cja-github I have replicated this error locally, I'm curious what the best solution would be. Perhaps we shouldn't rely on the Any thoughts from anyone? |
The Commenter resource tool loads no comments with a 409 and 404s on submitting a new comment.
Loading makes a request to http://127.0.0.1:8000/nova-api/comments?page=1&orderBy=created_at&orderByDirection=desc&viaResource=issues&viaResourceId=4&viaRelationship=comments&relationshipType=hasMany and throws Symfony\Component\HttpKernel\Exception\HttpException at \vendor\laravel\framework\src\Illuminate\Foundation\Application.php:1116
https://flareapp.io/share/J7oj2odP?error=J7oj2odP&owner_token=Z9rRtT9iV2S0HkeKk60A6GngRV1udzCF#F60L1116
Submitting a new comment 404s on http://127.0.0.1:8000/nova-api/comments
I installed as follows:
composer require kirschbaum-development/nova-comments
php artisan migrate
use Commentable; in my model and new Commenter(), in the fields function of the Nova resource.
The CommentsPanel works, but it's not worth having this package just for that, especially as there's no image/attachment functionality.
The text was updated successfully, but these errors were encountered: