Add behavior similar to SET NULL action. It will set relation column to NULL when referenced model is deleted.
For example
Class User extends Model {
use SoftDeletes, SoftCascadeTrait;
protected $softCascade = ['phone@setNull'];
public function phone()
{
return $this->hasOne(Phone::class);
}
}
Class Phone extends Model {
use SoftDeletes;
public function user()
{
return $this->belongsTo(User::class);
}
}
Will set NULL in phones.user_id if user was soft deleted.
Add behavior similar to
SET NULL
action. It will set relation column to NULL when referenced model is deleted.For example
Will set NULL in
phones.user_id
if user was soft deleted.