hootlex / laravel-moderation

A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.
MIT License
526 stars 68 forks source link

Trait method performDeleteOnModel collides with SoftDelete trait #5

Closed sebastiaanluca closed 8 years ago

sebastiaanluca commented 8 years ago

Trait method performDeleteOnModel has not been applied, because there are collisions with other trait methods on User.

\Illuminate\Database\Eloquent\SoftDeletes has the same method protected function performDeleteOnModel(). Can I use these together somehow? Should I just use the method from the soft delete trait?


Small update: both traits also define the $forceDeleting property, which cannot be rewritten or aliased. Why exactly is it being use? There's no need for it?

hootlex commented 8 years ago

Thanks for reporting.

I will try to find a workaround to be able to use it along with SoftDeletes.

About $forceDeleting you are right, it is useless :)

sebastiaanluca commented 8 years ago

@hootlex Used SoftDeletes::performDeleteOnModel insteadof Moderatable; in my model to favor the soft delete method. I think I can get away with this as Moderatable just finds it without scope and force deletes it.

The only thing that's keeping me from using soft delete now is that $forceDeleting variable :) Should I fork this library and use that or are you able to quickly delete that line and push to packagist?

hootlex commented 8 years ago

I have removed the unused variable in v1.0.4.

The only reason performDeleteOnModel exists is to achieve compatibility with Laravel 5 (https://github.com/hootlex/laravel-moderation/pull/1) but I consider removing it.

Can you provide more details about SoftDeletes::performDeleteOnModel insteadof Moderatable?

sebastiaanluca commented 8 years ago

Thanks! Updating right now :)

When using both traits, I just make it use the SoftDeletes performDeleteOnModel method using:

use SoftDeletes, Moderatable {
    SoftDeletes::performDeleteOnModel insteadof Moderatable;
}
hootlex commented 8 years ago

You are welcome. Function performDeleteOnModel has been removed in v1.0.5, so you can use it normally.