yu0307
376
16
Eloquent

Accessor on demand but not on every results.

Posted 1 year ago by yu0307

Hi all, I was just wondering if it's even possible in laravel to append an accessor to every row of a result?

!!! Not using $appends in the model. That will append that accessor to every results!!!

I'm trying to do something like this:

foo::find(2)->get('id','name','etc')->append('accessor');

as you can see, the accessor is appended to the result on a demand but not always and not to every results.

Thank you ~

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

Reply to

Use Markdown with GitHub-flavored code blocks.