What Tray2 said. When you are using a delete action, it just deletes the record, but you still need to manually set the fields to null. You can do it like this as well:
$row = Model::find($id);
$row->update(['column1' => null, 'column2' => null]);
$row->delete();
So first you update the columns and then you delete the record.
You could also set a custom delete method in your model, where you perform the above actions, so you don't have to put it in the controller for example. Or you could also use a model observer:
public static function boot ()
{
parent::boot();
self::deleting(function ($model) {
$model->update(['column1' => null, 'column2' => null]);
$model->delete();
});
}
Or perhaps even something like:
public static function boot ()
{
parent::boot();
self::deleted(function ($model) {
$model->update(['column1' => null, 'column2' => null]);
});
}
Not tested, but just something you could try, whatever suits your needs.