1 year ago

How to use transformers resource for blade

Posted 1 year ago by dadidi

Hi guys, I'm new to Laravel. I know how to use transformers for API already.

I use it for not only change the name of key but also change the value of the key.

Like this

'bill_status' => $this->status == 0 ? trans('tableLabel.bill_not_paid_yet') : ($this->status == 1 ? trans('tableLabel.bill_paid') : trans('tableLabel.bill_not_create_yet'))

Problem is I want to use this transform method not only for API but I want to pass it to view and use this, instead of write logic in blade view. But seem like it not work, I still get value as default from the database.

How can I solve my problem property?

Please sign in or create an account to participate in this conversation.