F
Filament6mo ago
Mina

Excel export

hi everyone, I really need help with this, I need to generate a csv file with this data: $user->name, $user->owner_email, $user->group, $user->plan_name, $user->lastRecurringCharge()->activated_on ?? null, $user->lastRecurringCharge()->trial_ends_on ?? null, $user->lastRecurringCharge()->status ?? null, $user->created_at, $user->updated_at, $user->currency, $user->shop_id, $user->locale, $user->timezone, $user->plan->name ?? null, Now, this lastRecurringCharge is a method and charges are a hasMany relationship. Since we can't use methods in column builder is there another way I can show this data? I tried with format state but that didn't work. I am pretty new to this so if I'm missing something please let me know
2 Replies
DrByte
DrByte6mo ago
Since we can't use methods in column builder
What's this "we can't use methods in column builder" part referring to?
Dennis Koch
Dennis Koch6mo ago
I think you are looking for getStateUsing(), but formatStateUsing() should also work. lastRecurringCharge() also sounds like it could be a relationship so it should even work with dot notation