I have a model with name : Category, which has a field is "image_url" (suppose that it's a big photo). How do I only show thumbnail image in BREAD browse mode of Category?
Thank you!
I ended up overriding the default Voyager bread view for the one table, as per https://docs.laravelvoyager.com/customization/overriding-files#overriding-bread-views .. which says for version 1.1:
You can override any of the BREAD views for a single BREAD by creating a new folder in resources/views/vendor/voyager/slug-name where slug-name is the slug that you have assigned for that table. There are 4 files that you can override:
browse.blade.php
edit-add.blade.php
read.blade.php
order.blade.php
Alternatively you can override the views for all BREADs by creating any of the above files under resources/views/vendor/voyager/bread
.. I just needed to override the 'browse' view. I also created a custom formfield as per https://docs.laravelvoyager.com/customization/adding-custom-formfields - the code for which just returned an <img>
element with the src url correctly formatted.
Finally, in the custom 'browse' view, I added logic to check for the new formfield and returned code to display the image.
Would be SO good if there was another 'Optional Details' field in the BREAD editor for formatting the display in the browse page.
Anyway, hope that helps and I hope someone can point me in the direction of a more straightforward way of doing this ..