Comments (2)
A possible workaround I've come up with, and it seems to work, is replacing the comment()
method in your own trait with a relationship (since Nova is assuming that it is one), and using your custom trait instead of the package's one.
We're not using the comment()
method in our project (only the commentAsUser()
), so we don't βmiss itβ. :)
All your models:
- use BeyondCode\Comments\Traits\HasComments;
+ use App\Traits\HasComments;
app/Comment.php
:
<?php
namespace App;
use BeyondCode\Comments\Comment as CommentModel;
use App\Traits\HasComments;
class Comment extends CommentModel
{
use HasComments;
}
app/Traits/HasComments.php
:
<?php
namespace App\Traits;
use BeyondCode\Comments\Traits\HasComments as BaseCommentsTrait;
trait HasComments
{
use BaseCommentsTrait;
public function comment(string $str = '')
{
return $this->commentable(); // because Nova is expecting a relationship here
}
}
I hope this helps for everyone looking to settle for a semi-hacky solution. π
from laravel-comments.
Nice workaround!
Thanks!
from laravel-comments.
Related Issues (20)
- Please add support for Laravel 6.0 HOT 3
- Laravel 7 support HOT 9
- Installation failure on Laravel 7.12 HOT 7
- update package in packagist HOT 2
- Laravel 8 Support HOT 1
- Laravel 8 Support, Please
- Comment replies - usage guide HOT 2
- is there any blade syntax to load the comments and guest posting? HOT 1
- Support for user who approved the comments HOT 1
- Installation failure - PHP 8 not supported HOT 2
- PHP 8 issue
- Field 'commentable_type' doesn't have a default value ....
- model comments HOT 1
- How can i get post UUID from a comment ?
- DISCUSSION : implement upload file functionnality to the comments HOT 1
- Supporting new PHP Versions HOT 1
- Broken composer CDN version HOT 1
- Extend comments model HOT 1
- Commentor Name HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-comments.