Support the ongoing development of Laravel.io →
posted 6 years ago
Last updated 1 year ago.
0

To define an accessor, create a getFooAttribute method on your model where Foo is the "studly" cased name of the column you wish to access. In this example, we'll define an accessor for the first_name attribute. The accessor will automatically be called by Eloquent when attempting to retrieve the value of the first_name attribute:

By:Xtreem Solution

Top laravel web developers

Dedicated PHP Developer

Last updated 6 years ago.
0

Thanks and yes you are right but i dont want to retrieve the attribute, i just want to fetch the collection and then send it back to api response in json formate.

when snak_attribute is true then it work perfectly.

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Hamid hamid09430 Joined 1 Jan 2018

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.