-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added macro helpers for export availability #100
Added macro helpers for export availability #100
Conversation
Nice! I've had a similar idea for a while. Nice PR. I'll review it soon! |
I need this as well.. either that or a way to transform before export so I can strip the html tags Any chance you'll merge this soon @patrickbrouwers ? |
I'll review it after my holiday is over |
@patrickbrouwers did you have any time to review this ? This is a really needed feature if you can have a look 😄 Thanks |
Not yet, but I think I'll be happy to add both solutions. |
Yes I agree, this one is more clean but mine allows to join external table easily. might be good to merge both yes |
Any progress on the merge? I don't understand the reason for the styleci to fail, is it because of the no newline at the end of the file? |
@rickgoemans no worries about styleci, it will run after merge anyway. I haven't gotten around to it yet, but still on my planning to merge it. |
Thanks @rickgoemans for the great addition! Can you add some documentation for this over there: https://docs.laravel-excel.com/nova/1.x/exports/customizations.html (https://github.com/maatwebsite/laravel-excel-docs/edit/master/nova/1.x/exports/customizations.md) |
Intro
I've added some useful macros to the Nova Field which helps to determine a whether a field is available on the export or not.
There are 3 macros:
Reason
The reason for this is on the index and/or detail requests you'll want to format fields like email addresses and phone numbers as HTML using a
displayUsing
callback. But this results in errors saying that thedisplayUsing
callback is receiving a null value where it expects a string. You could change the type hinting to?string
or remove the type hinting, but that is not a good solution in my opinion.Example (which throws errors):
Solution (after this being merged):
Outro
I'm wondering what others think of this solution and maybe this can get merged so others can enjoy these helpful macros.