Use old('attribute', $model->translattions['attribute']['key']) in form partial #285
Unanswered
joseantoniopino
asked this question in
Q&A
Replies: 1 comment
-
It's been a long time but maybe this can help someone: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the edit and create inputs shared in the same partial.
When I try to access the create view it gives me the following error:
Undefined array key "es" (View: /route/to/project/resources/views/admin/products/partials/basic-info.blade.php)
In the controller I am passing a
new Product()
to the create view to be able to makeold('attribute', $product->attribute)
(when returning null the input remains empty)In this case, as the translations come in an array, and the
new Product()
has no translations yet, it complains that there is no ['es']Is there a way to use
old()
in shared partial together with translations?Thanks in advance.
PD:
Obviously this can be done with
{{old ('name_es', $product->translations['name']['es'] ?? null)}}
But my question is more focused on knowing if there is a method in the package that allows to bring an object for example
$product->translation->name->es
or similar.Beta Was this translation helpful? Give feedback.
All reactions