mopo922/LaravelTreats

delete HasCompositePrimaryKey

Closed this issue · 3 comments

Hi,
I see the methods setKeysForSaveQuery() and find() in the trait, but I was wondering how the delete() would work ? No risk of deleting everything

You can look at the source of Illuminate\Database\Eloquent\Model to see that Model::delete() calls Model::performDeleteOnModel() which calls - tada! - Model::setKeysForSaveQuery().

I should've checked. beautiful

Np. Laravel is such a well-written framework. It makes it easy to override one method like this to adapt it to your needs.