When using this code:
Checkboxes::make(trans_choice('Attribute', 2), 'product_attributes')
->options(\App\Models\Tenants\Products\Attribute::pluck('label', 'id')->toArray())
->resolveUsing(fn() => $this->resource->attributes()->get()->implode('id', ','))
->hideFromIndex(),
It shows checkboxes properly with the right values in details and editing page as well. But After checking/unchecking some checkboxes, changes are not applied.
A workaround is using displayUsing instead and the new code is :
Checkboxes::make(trans_choice('Attribute', 2), 'product_attributes')
->options(\App\Models\Tenants\Products\Attribute::pluck('label', 'id')->toArray())
->displayUsing(fn() => $this->resource->attributes()->get()->implode('id', ','))
->hideFromIndex(),
In this case, changes are applied but since displayUsing is only used by nova in details page, and not in editing page. Checkboxes are not checked by default in editing page.
Thanks,
When using this code:
It shows checkboxes properly with the right values in details and editing page as well. But After checking/unchecking some checkboxes, changes are not applied.
A workaround is using
displayUsinginstead and the new code is :In this case, changes are applied but since displayUsing is only used by nova in details page, and not in editing page. Checkboxes are not checked by default in editing page.
Thanks,