nova-tab-translatable icon indicating copy to clipboard operation
nova-tab-translatable copied to clipboard

Slug preview does not work with multiple tabs instances

Open fsavina-akqa opened this issue 9 months ago • 2 comments

Hello, thanks for this useful package.

I have a model with multiple instances of NovaTabTranslatable and I get a 404 error when the slug preview is getting loaded.

The reason why this is happening is because this foreach cycle should terminate when the field is found. Otherwise the following iterations will overwrite the value of $field with null.

// Kongulov\NovaTabTranslatable\Http\Controllers\FieldPreviewController, line 43

foreach ($tabs as $tab) {
  $field = collect($tab->data)->first(function($field) use ($request){
    return isset($field->attribute) &&
    $field->attribute == $request->field;
  });
} 

Thank you very much

fsavina-akqa avatar Jun 03 '24 07:06 fsavina-akqa