Closed julem-sen closed 4 years ago
I kinda found a bug to the package, when someone already replied to the other users comment, the comment that has a reply can't be deleted, since it is connected to the child_id.
I kinda found a bug to the package, when someone already replied to the other users comment, the comment that has a reply can't be deleted, since it is connected to the child_id.
It should be possible to delete the parent comment (if the user is its owner) and it should delete all child comments.
Hi! this really help me finished what I'm working on, Thank you for this! Keep up the good work!
I just want to know if there is an option that only
type=admins
can reply to a users comment.
See here. Also see the config. You should overwrite the reply
method to return true if the user is admin. That should do it.
I have a problem when migrating the table for the comments, I always get an error unless I change onDelete('cascade')
to `onDelete('no action'), I think this is where the problem lies when I delete a comment with replies. I'm still looking for solutions on the web but got no luck. I tried the other solutions which work for some people but for me it didn't.
SQLSTATE[23000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "comments_child_id_foreign". The conflict occurred in database "UserMF", table "dbo.comments", column 'child_id'. (SQL: delete from [comments] where [id] = 16)
this is the error I get, the migration is successful when I changed the onDelete()
to onDelete('no action')
I see. You are using MSSQL server for the database. I have not tested it with that DB server. I use MySQL or MariaDB. onDelete('cascade')
deletes the child comments. Without it it should not work. Try searching the Internet for: onDelete('cascade')
, laravel
, mssql
.
okay so MSSQL doesn't accept foreignkeys on the same table. I tried it manually it didn't work so it must be on another table, basically I need to change some on the laravelista models or add another model
You can very easily customize the migrations and models. See the readme and config.
Can I specify 2 models on the @comments(['model' => model])
?
Don't know what would be the purpose of that but you could if you updated the logic in component. See readme for customization.
Its actually for the error I am getting when using "onDelete('cascade')" , I think I found a solution for it, I just need another table for replies.
The solution is to figure out why you can't use onDelete('cascade'). It is a very common thing on which I rely in almost all of my applications. Not having it means that there is something wrong with the db.
I will be using onDelete('cascade') but with two tables, one for comments and one for replies, instead of using Config::get('comments.model')
, I will try to use new Replies()
. I think onDelete('cascade') on MSSQL only works if its not on the same table. I did really surf the web for solutions I read about triggers, I don't know if it will work since its not good to use Triggers when using constraints.
Hi! this really help me finished what I'm working on, Thank you for this! Keep up the good work!
I just want to know if there is an option that only
type=admins
can reply to a users comment.