samedi 3 mars 2018

Show Dynamic image data to the img html element - Laravel, Collective

I am dealing with 2 variables here. 1st being $xyz which contains all the values I would like to bind to the form and 2nd being $fields which contains all the input fields.

I am looping through $fields->field_name to show all the form fields from the database.

But 1 of the fields being an image, which is a different case. I am simply trying to bind manually the image url to the img element here.

To successfully bind an image. I need 2 things, 1 being the field name which I can get it from $fields->field_name and second is the url which is in $xyz.

so, I plan to do something like: $xyz->get($fields->field_name). This means, I try to access $xyz object and get dynamic image field name. but not sure why my below code throws error:

<img src=" "  />

code like above works completely fine in Controller, not sure how to achieve this in Blade front-end Views.

error:

Type error: Argument 1 passed to Illuminate\Database\Grammar::columnize() must be of the type array, string given



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire